联调算法库

修改冀北台账问题
This commit is contained in:
GGJ
2024-09-11 20:37:40 +08:00
parent a8c1fa46c0
commit 28d9af0cb4
11 changed files with 437 additions and 230 deletions

View File

@@ -4,155 +4,190 @@
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
<pane :size="size">
<algorithmTree
ref="treeRef"
:default-expand-all="false"
:default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []"
:current-node-key="monitoringPoint.state.lineId"
@node-click="handleNodeClick"
@init="handleNodeClick"
@onAddTree="onAddTree"
></algorithmTree>
</pane>
<pane style="background: #fff" :style="height">
<!-- <div :style="height"></div> -->
<TableHeader ref="TableHeaderRef" :show-search="false">
<template v-slot:select>
<el-radio-group v-model="tableStore.table.params.radio2" @change="tableStore.index()">
<el-radio-button label="监测覆盖率" value="1" />
<el-radio-button label="装置在线率" value="2" />
<el-radio-button label="数据完整性" value="3" />
<div class="boxTop">
<div>
<el-radio-group v-model="radio">
<el-radio-button v-for="(item, i) in dotList?.childrens" :label="item.name" :value="i" />
</el-radio-group>
</template>
<template #operation>
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</el-button>
</template>
</TableHeader>
<Table ref="tableRef"></Table>
</div>
<div>
<el-button
icon="el-icon-Plus"
type="primary"
@click="addUser"
v-if="dotList?.childrens?.length > 0"
>
新增
</el-button>
</div>
</div>
<div :style="heightTab">
<vxe-table height="auto" v-bind="defaultAttribute" :data="dotList?.childrens[radio]?.children">
<vxe-column field="name" title="算法名称"></vxe-column>
<vxe-column field="createTime" title="创建时间"></vxe-column>
<vxe-column field="definition" title="定义"></vxe-column>
<vxe-column field="period" title="计算周期">
<template #default="{ row }">
{{
row.period == 0
? '日'
: row.period == 1
? '月'
: row.period == 2
? '季'
: row.period == 3
? '年'
: ''
}}
</template>
</vxe-column>
<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">
{{ row.useFLag === 1 ? '是' : '否' }}
</el-tag>
</template>
</vxe-column>
<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="del(row)">
<template #reference>
<el-button type="danger" link>删除</el-button>
</template>
</el-popconfirm>
</template>
</vxe-column>
</vxe-table>
</div>
</pane>
</splitpanes>
<!-- 树弹框 -->
<addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" />
<!-- 弹框 -->
<PopupEdit ref="popupEditRef" />
<PopupEdit ref="popupEditRef" @getTree="treeRef.loadData(dotList.id)" />
</div>
</template>
<script setup lang="ts">
import { onMounted, ref, provide } from 'vue'
import 'splitpanes/dist/splitpanes.css'
import { Splitpanes, Pane } from 'splitpanes'
import TableStore from '@/utils/tableStore'
import algorithmTree from '@/components/tree/pqs/algorithmTree.vue'
import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout'
import Table from '@/components/table/index.vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import { getLineExport, getList, selectReleation } from '@/api/event-boot/report'
import addTree from './components/addTree.vue'
import PopupEdit from './components/form.vue'
import { useMonitoringPoint } from '@/stores/monitoringPoint'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import { deleteyById } from '@/api/supervision-boot/database/index'
defineOptions({
name: 'database/algorithm'
})
const monitoringPoint = useMonitoringPoint()
const height = mainHeight(20)
const heightTab = mainHeight(82)
const size = ref(0)
const addTreeRef = ref()
const treeRef = ref()
const popupEditRef = ref()
const TableHeaderRef = ref()
const dotList: any = ref({
name: monitoringPoint.state.lineName.split('>')[3],
id: monitoringPoint.state.lineId,
level: 6
})
const dotList: any = ref()
const templatePolicy: any = ref([])
const tableStore = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
column: [
{ title: '算法名称', field: 'name' },
{
title: '定义',
field: 'name1'
},
{
title: '计算公式',
field: 'name2'
},
{
title: '计算周期',
field: 'name3'
},
{
title: '数据来源',
field: 'name4'
},
{
title: '是否启用',
field: 'name5',
render: 'tag',
effect: 'dark',
custom: {
0: 'info',
1: 'success'
},
replaceValue: {
0: '否',
1: '是'
}
}
// {
// title: '操作',
// align: 'center',
// width: '180',
// render: 'buttons',
// buttons: [
// {
// name: 'edit',
// title: '编辑',
// type: 'primary',
// icon: 'el-icon-EditPen',
// render: 'basicButton',
// click: async row => {}
// }
// ]
// }
],
loadCallback: () => {
tableStore.table.data = [
{
name: '测试名称',
name1: 'xxx',
name2: 'XXX',
name3: '1月',
name4: '单体系统',
name5: '1'
},
{
name: '测试名称',
name1: 'xxx',
name2: 'XXX',
name3: '1月',
name4: '单体系统',
name5: '0'
}
]
}
})
tableStore.table.params.radio2 = '1'
// const tableStore = new TableStore({
// url: '/supervision-boot/libalgorithm/queryAllAlgorithmLibrary',
// method: 'GET',
// column: [
// { title: '算法名称', field: 'name' },
// {
// title: '定义',
// field: 'name1'
// },
// {
// title: '计算公式',
// field: 'name2'
// },
// {
// title: '计算周期',
// field: 'name3'
// },
// {
// title: '数据来源',
// field: 'name4'
// },
// {
// title: '是否启用',
// field: 'name5',
// render: 'tag',
// effect: 'dark',
// custom: {
// 0: 'info',
// 1: 'success'
// },
// replaceValue: {
// 0: '否',
// 1: '是'
// }
// }
// ],
// loadCallback: () => {}
// })
const radio = ref(0)
// 弹框
const addUser = () => {
popupEditRef.value.open('新增算法')
popupEditRef.value.open({
title: '新增算法',
row: dotList.value?.childrens[radio.value]
})
}
provide('tableStore', tableStore)
onMounted(() => {
const dom = document.getElementById('navigation-splitpanes')
if (dom) {
size.value = Math.round((180 / dom.offsetHeight) * 100)
}
tableStore.index()
// tableStore.index()
})
const handleNodeClick = (data: any, node: any) => {
dotList.value = data
console.log('🚀 ~ handleNodeClick ~ data:', data)
if (data.pid != '0') {
dotList.value = data
radio.value = 0
}
}
const onAddTree = () => {
addTreeRef.value.open('新增')
}
// 删除
const del = (row: any) => {
deleteyById({ id: row.id }).then(res => {
ElMessage.success('删除成功')
treeRef.value.loadData()
})
}
// 修改
const edit = (row: any) => {
popupEditRef.value.open({
title: '修改算法',
row: row
})
}
</script>
<style lang="scss">
@@ -162,22 +197,7 @@ const handleNodeClick = (data: any, node: any) => {
.grid-content {
text-align: center;
}
.divBox {
width: 250px;
height: 31px;
margin: auto;
line-height: 32px;
border: 1px solid #c9c9c9;
&:hover {
border: 1px solid #002255;
}
}
.box {
padding: 10px;
// margin-top: 10px;
overflow-y: auto;
font-size: 15px;
}
.el-divider--horizontal {
margin: 10px 0;
}
@@ -185,4 +205,10 @@ const handleNodeClick = (data: any, node: any) => {
margin-top: 5px;
margin-bottom: 5px;
}
.boxTop {
height: 52px;
padding: 10px 10px 10px 0;
display: flex;
justify-content: space-between;
}
</style>