修改算法库新增
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button icon="el-icon-Edit" type="primary" @click="revise">修改</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary" @click="deletes">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,22 +57,27 @@
|
||||
<vxe-column field="source" title="数据来源"></vxe-column>
|
||||
<vxe-column field="useFLag" title="是否启用">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.useFLag === 1 ? 'success' : 'info'" effect="dark">
|
||||
<el-tag
|
||||
:type="row.useFLag === 1 ? 'success' : 'info'"
|
||||
effect="dark"
|
||||
style="cursor: pointer"
|
||||
@click="change(row)"
|
||||
>
|
||||
{{ row.useFLag === 1 ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column title="操作" width="150px">
|
||||
<!-- <vxe-column title="操作" width="150px">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="edit(row)">修改</el-button>
|
||||
<!-- <el-button type="danger" link @click="del(row)">删除</el-button> -->
|
||||
<!-- <el-popconfirm title="确定删除吗?" confirm-button-type='danger' @confirm="del(row)">
|
||||
<el-button type="danger" link @click="del(row)">删除</el-button>
|
||||
<el-popconfirm title="确定删除吗?" confirm-button-type='danger' @confirm="del(row)">
|
||||
<template #reference>
|
||||
<el-button type="danger" link>删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm> -->
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-column> -->
|
||||
</vxe-table>
|
||||
</div>
|
||||
</pane>
|
||||
@@ -79,7 +85,11 @@
|
||||
<!-- 树弹框 -->
|
||||
<addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" />
|
||||
<!-- 弹框 -->
|
||||
<PopupEdit ref="popupEditRef" @getTree="treeRef.loadData(dotList.id)" />
|
||||
<PopupEdit
|
||||
ref="popupEditRef"
|
||||
v-if="popupEditFlag"
|
||||
@getTree="treeRef.loadData(dotList.id), (popupEditFlag = false)"
|
||||
/>
|
||||
<!-- 删除 -->
|
||||
<el-dialog v-model="dialogVisible" title="请选择需要删除的数据" width="400">
|
||||
<el-tree-select
|
||||
@@ -88,6 +98,7 @@
|
||||
filterable
|
||||
check-strictly
|
||||
:props="defaultProps"
|
||||
default-expand-all
|
||||
:render-after-expand="false"
|
||||
/>
|
||||
<template #footer>
|
||||
@@ -113,7 +124,7 @@ import PopupEdit from './components/form.vue'
|
||||
import { useMonitoringPoint } from '@/stores/monitoringPoint'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { deleteyById } from '@/api/supervision-boot/database/index'
|
||||
import { queryAllAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
||||
import { queryAllAlgorithmLibrary, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
||||
defineOptions({
|
||||
name: 'database/algorithm'
|
||||
})
|
||||
@@ -123,6 +134,7 @@ const heightTab = mainHeight(82)
|
||||
const size = ref(0)
|
||||
const addTreeRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const popupEditFlag = ref(false)
|
||||
const treeRef = ref()
|
||||
const popupEditRef = ref()
|
||||
const TreeData = ref([])
|
||||
@@ -175,12 +187,24 @@ const templatePolicy: any = ref([])
|
||||
// })
|
||||
const radio = ref(0)
|
||||
|
||||
// 弹框
|
||||
// 新增弹框
|
||||
const addUser = () => {
|
||||
popupEditRef.value.open({
|
||||
title: '新增算法',
|
||||
row: dotList.value?.childrens[radio.value]
|
||||
})
|
||||
popupEditFlag.value = true
|
||||
setTimeout(() => {
|
||||
popupEditRef.value.open({
|
||||
title: '新增算法'
|
||||
})
|
||||
}, 100)
|
||||
}
|
||||
// 修改弹框
|
||||
const revise = () => {
|
||||
popupEditFlag.value = true
|
||||
setTimeout(() => {
|
||||
popupEditRef.value.open({
|
||||
title: '修改算法',
|
||||
row: dotList.value
|
||||
})
|
||||
}, 100)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -192,7 +216,6 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
const handleNodeClick = (data: any, node: any) => {
|
||||
console.log('🚀 ~ handleNodeClick ~ data:', data)
|
||||
if (data.pid != '0') {
|
||||
dotList.value = data
|
||||
radio.value = 0
|
||||
@@ -202,6 +225,7 @@ const onAddTree = () => {
|
||||
addTreeRef.value.open('新增')
|
||||
}
|
||||
const deletes = () => {
|
||||
TreeValue.value = ''
|
||||
queryAllAlgorithmLibrary().then(res => {
|
||||
TreeData.value = res.data
|
||||
})
|
||||
@@ -229,11 +253,18 @@ const del = () => {
|
||||
// return
|
||||
// }
|
||||
}
|
||||
// 修改
|
||||
const edit = (row: any) => {
|
||||
popupEditRef.value.open({
|
||||
title: '修改算法',
|
||||
row: row
|
||||
// 启用
|
||||
const change = (row: any) => {
|
||||
console.log('🚀 ~ change ~ row:', row)
|
||||
ElMessageBox.confirm(`请确认是否${row.useFLag == 0 ? '启用' : '关闭'}算法?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
updateAlgorithmLibrary({ ...row, useFLag: row.useFLag == 0 ? 1 : 0 }).then(res => {
|
||||
ElMessage.success(row.useFLag == 0 ? '启用' : '关闭' + '成功')
|
||||
treeRef.value.loadData(dotList.value.id)
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user