联调算法库

修改冀北台账问题
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

@@ -0,0 +1,40 @@
import createAxios from '@/utils/request'
/**
* 查询所有算法库树结构
*/
export const queryAllAlgorithmLibrary = () => {
return createAxios({
url: '/supervision-boot/libalgorithm/queryAllAlgorithmLibrary',
method: 'GET'
})
}
/**
* 算法库新增
*/
export const addAlgorithm = (data: any) => {
return createAxios({
url: '/supervision-boot/libalgorithm/add',
method: 'POST',
data
})
}
/**
* 算法库删除
*/
export const deleteyById = (data: any) => {
return createAxios({
url: '/supervision-boot/libalgorithm/deleteyById',
method: 'GET',
params:data
})
}
/**
* 算法库修改
*/
export const updateAlgorithmLibrary = (data: any) => {
return createAxios({
url: '/supervision-boot/libalgorithm/updateAlgorithmLibrary',
method: 'POST',
data
})
}

View File

@@ -8,7 +8,7 @@
v-bind="Object.assign({}, defaultAttribute, $attrs)" v-bind="Object.assign({}, defaultAttribute, $attrs)"
@checkbox-all="selectChangeEvent" @checkbox-all="selectChangeEvent"
@checkbox-change="selectChangeEvent" @checkbox-change="selectChangeEvent"
:showOverflow='showOverflow' :showOverflow="showOverflow"
> >
<!-- Column 组件内部是 el-table-column --> <!-- Column 组件内部是 el-table-column -->
<template v-if="isGroup"> <template v-if="isGroup">
@@ -59,7 +59,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, nextTick, inject, computed, onMounted } from 'vue' import { ref, nextTick, inject, computed, onMounted, watch } from 'vue'
import type { ElTable } from 'element-plus' import type { ElTable } from 'element-plus'
import { VxeTableEvents, VxeTableInstance } from 'vxe-table' import { VxeTableEvents, VxeTableInstance } from 'vxe-table'
import FieldRender from '@/components/table/fieldRender/index.vue' import FieldRender from '@/components/table/fieldRender/index.vue'
@@ -116,7 +116,12 @@ const selectChangeEvent: VxeTableEvents.CheckboxChange<any> = ({ checked }) => {
const getRef = () => { const getRef = () => {
return tableRef.value return tableRef.value
} }
watch(
() => tableStore.table.data,
newVal => {
tableStore.onTableAction('selection-change', [])
}
)
defineExpose({ defineExpose({
getRef getRef
}) })

View File

@@ -1,50 +1,50 @@
<template> <template>
<div :style="{ width: menuCollapse ? '40px' : props.width }" style='transition: all 0.3s; overflow: hidden'> <div :style="{ width: menuCollapse ? '40px' : props.width }" style="transition: all 0.3s; overflow: hidden">
<Icon <Icon
v-show='menuCollapse' v-show="menuCollapse"
@click='onMenuCollapse' @click="onMenuCollapse"
:name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'" :name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'"
:class="menuCollapse ? 'unfold' : ''" :class="menuCollapse ? 'unfold' : ''"
size='18' size="18"
class='fold ml10 mt20 menu-collapse' class="fold ml10 mt20 menu-collapse"
style='cursor: pointer' style="cursor: pointer"
/> />
<div class='cn-tree' :style='{ opacity: menuCollapse ? 0 : 1 }'> <div class="cn-tree" :style="{ opacity: menuCollapse ? 0 : 1 }">
<div style='display: flex; align-items: center' class='mb10'> <div style="display: flex; align-items: center" class="mb10">
<el-input v-model='filterText' placeholder='请输入内容' clearable> <el-input v-model="filterText" placeholder="请输入内容" clearable>
<template #prefix> <template #prefix>
<Icon name='el-icon-Search' style='font-size: 16px' /> <Icon name="el-icon-Search" style="font-size: 16px" />
</template> </template>
</el-input> </el-input>
<Icon <Icon
@click='onMenuCollapse' @click="onMenuCollapse"
:name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'" :name="menuCollapse ? 'el-icon-Expand' : 'el-icon-Fold'"
:class="menuCollapse ? 'unfold' : ''" :class="menuCollapse ? 'unfold' : ''"
size='18' size="18"
class='fold ml10 menu-collapse' class="fold ml10 menu-collapse"
style='cursor: pointer' style="cursor: pointer"
v-if='props.canExpand' v-if="props.canExpand"
/> />
<el-button icon="el-icon-Plus" v-if="props.addTree" type="primary" class="ml10" @click="onAddTree">新增</el-button>
</div> </div>
<el-tree <el-tree
style='flex: 1; overflow: auto' style="flex: 1; overflow: auto"
ref='treeRef' ref="treeRef"
:props='defaultProps' :props="defaultProps"
highlight-current highlight-current
:filter-node-method="filterNode"
:filter-node-method='filterNode' node-key="id"
node-key='id' v-bind="$attrs"
v-bind='$attrs'
> >
<template #default='{ node, data }'> <template #default="{ node, data }">
<span class='custom-tree-node'> <span class="custom-tree-node">
<Icon <Icon
:name='data.icon' :name="data.icon"
style='font-size: 16px' style="font-size: 16px"
:style='{ color: data.color }' :style="{ color: data.color }"
v-if='data.icon' v-if="data.icon"
/> />
<span style='margin-left: 4px'>{{ node.label }}</span> <span style="margin-left: 4px">{{ node.label }}</span>
</span> </span>
</template> </template>
</el-tree> </el-tree>
@@ -52,7 +52,7 @@
</div> </div>
</template> </template>
<script lang='ts' setup> <script lang="ts" setup>
import useCurrentInstance from '@/utils/useCurrentInstance' import useCurrentInstance from '@/utils/useCurrentInstance'
import { ElTree } from 'element-plus' import { ElTree } from 'element-plus'
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
@@ -60,15 +60,17 @@ import { ref, watch } from 'vue'
defineOptions({ defineOptions({
name: 'govern/tree' name: 'govern/tree'
}) })
const emit = defineEmits(['onAddTree'])
interface Props { interface Props {
width?: string width?: string
canExpand?: boolean canExpand?: boolean
addTree?: boolean
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
width: '280px', width: '280px',
canExpand: true canExpand: true,
addTree: false
}) })
const { proxy } = useCurrentInstance() const { proxy } = useCurrentInstance()
const menuCollapse = ref(false) const menuCollapse = ref(false)
@@ -88,11 +90,15 @@ const filterNode = (value: string, data: any) => {
if (!value) return true if (!value) return true
return data.name.includes(value) return data.name.includes(value)
} }
// 添加树
const onAddTree = () => {
emit('onAddTree')
}
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
defineExpose({ treeRef }) defineExpose({ treeRef })
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.cn-tree { .cn-tree {
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;

View File

@@ -39,11 +39,14 @@ const info = (id: any) => {
item4.children.forEach((item5: any) => { item4.children.forEach((item5: any) => {
item5.icon = 'el-icon-OfficeBuilding' item5.icon = 'el-icon-OfficeBuilding'
item5.level = 300 item5.level = 300
item5.id = item4.id // item5.id = item4.id
item5.children.forEach((item6: any) => { item5.children.forEach((item6: any) => {
item6.icon = 'el-icon-HelpFilled' item6.icon = 'el-icon-HelpFilled'
item6.level = 300 if (item6.name == '电网侧' && item6.children.length == 0) {
item6.id = item4.id item6.level = 400
} else {
item6.level = 400
}
item6.children.forEach((item7: any) => { item6.children.forEach((item7: any) => {
item7.icon = 'el-icon-Film' item7.icon = 'el-icon-Film'
item7.level = 400 item7.level = 400

View File

@@ -1,7 +1,16 @@
<template> <template>
<div class="point-tree"> <div class="point-tree">
<div style="flex: 1; overflow: hidden"> <div style="flex: 1; overflow: hidden">
<Tree ref="treeRef" :data="tree" style="width: 100%; height: 100%" :canExpand="false" v-bind="$attrs" /> <Tree
ref="treeRef"
:data="tree"
:canExpand="false"
style="width: 100%; height: 100%"
v-bind="$attrs"
default-expand-all
addTree
@onAddTree="onAddTree"
/>
</div> </div>
</div> </div>
</template> </template>
@@ -13,11 +22,11 @@ import { useAdminInfo } from '@/stores/adminInfo'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree' import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
import { queryAllAlgorithmLibrary } from '@/api/supervision-boot/database/index'
defineOptions({ defineOptions({
name: 'pms/pointTree' name: 'pms/pointTree'
}) })
const emit = defineEmits(['init']) const emit = defineEmits(['init', 'onAddTree'])
const attrs = useAttrs() const attrs = useAttrs()
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
const dictData = useDictData() const dictData = useDictData()
@@ -26,48 +35,45 @@ const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Ty
const tree = ref() const tree = ref()
const treeRef = ref() const treeRef = ref()
const loadData = () => { const loadData = (id?: any) => {
console.log('🚀 ~ loadData ~ id:', id)
let nodeKey = '' let nodeKey = ''
let res = { queryAllAlgorithmLibrary().then(res => {
data: [ res.data.forEach((item: any) => {
{ item.icon = 'el-icon-FolderOpened'
name: '运行管理',
id: '1',
children: [
{
name: '运行指标',
id: '2'
},
{
name: '数据质量核查',
id: '3'
}
]
}
]
}
// getTerminalTreeForFive(form).then(res => {
res.data.forEach((item: any) => {
item.icon = 'el-icon-FolderOpened'
item.color = config.getColorVal('elementUiPrimary')
item.children.forEach((item2: any) => {
item2.icon = 'el-icon-Document'
item.color = config.getColorVal('elementUiPrimary') item.color = config.getColorVal('elementUiPrimary')
item.children.forEach((item2: any) => {
item2.icon = 'el-icon-Document'
item2.color = config.getColorVal('elementUiPrimary')
item2.childrens = item2.children
item2.children = []
if (item2.id == id) {
emit('init', item2)
}
})
}) })
nodeKey = res.data[0].children[0].id
tree.value = res.data
if (id) {
setTimeout(() => {
treeRef.value.treeRef.setCurrentKey(id)
}, 10)
} else {
setTimeout(() => {
treeRef.value.treeRef.setCurrentKey(nodeKey)
emit('init', res.data[0].children[0])
}, 10)
}
}) })
}
nodeKey = res.data[0].children[0].id const onAddTree = () => {
emit('init', res.data[0].children[0]) emit('onAddTree')
tree.value = res.data
if (nodeKey) {
setTimeout(() => {
treeRef.value.treeRef.setCurrentKey(nodeKey)
}, 10)
}
// })
} }
loadData() loadData()
defineExpose({ loadData })
</script> </script>
<style lang="scss"> <style lang="scss">
.point-tree { .point-tree {

View File

@@ -80,8 +80,8 @@ export default class TableStore {
) )
).then((res: any) => { ).then((res: any) => {
if (res.data) { if (res.data) {
this.table.data = res.data.records || res.data this.table.data = res.data?.records || res.data
this.table.total = res.data.total || res.data.length || 0 this.table.total = res.data?.total || res.data.length || 0
} else { } else {
this.table.data = [] this.table.data = []
this.table.total = 0 this.table.total = 0

View File

@@ -2051,6 +2051,10 @@ const remove = () => {
}) })
return return
} }
if (nodeData.value.id == null) {
ElMessage.warning('无法删除该节点')
return
}
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', { ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@@ -2083,6 +2087,8 @@ const remove = () => {
const next = async () => { const next = async () => {
await mainForm.value.validate((valid: any) => { await mainForm.value.validate((valid: any) => {
if (valid) { if (valid) {
console.log("🚀 ~ awaitmainForm.value.validate ~ nodeLevel.value:", nodeLevel.value)
switch (nodeLevel.value) { switch (nodeLevel.value) {
case 100: case 100:
addProvince() addProvince()
@@ -2317,6 +2323,12 @@ const getNodeIndex = () => {
} }
/**查询节点内容 */ /**查询节点内容 */
const queryNodeContent = () => { const queryNodeContent = () => {
console.log("🚀 ~ queryNodeContent ~ nodeData.value:", nodeData.value)
if (nodeData.value.id == null) {
// ElMessage.warning('1111111')
return
}
let data = { let data = {
id: nodeData.value.id, id: nodeData.value.id,
level: nodeLevel.value level: nodeLevel.value

View File

@@ -0,0 +1,95 @@
<template>
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="700px">
<el-scrollbar>
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef">
<el-form-item label="上级名称">
<!-- <el-input v-model="form.pid" placeholder="上级名称" /> -->
<el-tree-select
v-model="form.pid"
:data="dataTree"
check-strictly
clearable
:render-after-expand="false"
:props="defaultProps"
/>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="名称" />
</el-form-item>
</el-form>
</el-scrollbar>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submit">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, inject } from 'vue'
import { reactive } from 'vue'
import { ElMessage } from 'element-plus'
import { queryAllAlgorithmLibrary, addAlgorithm } from '@/api/supervision-boot/database/index'
const dialogVisible = ref(false)
const title = ref('')
const emit = defineEmits(['getTree'])
const formRef = ref()
// 注意不要和表单ref的命名冲突
const form = reactive<anyObj>({
name: '',
pid: ''
})
const defaultProps = {
children: 'children',
label: 'name',
value: 'id'
}
const rules = {
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }]
}
const dataTree = ref([])
const open = (text: string, data?: anyObj) => {
getTheTree()
title.value = text
dialogVisible.value = true
if (data) {
// 表单赋值
for (let key in form) {
form[key] = data[key]
}
} else {
// 在此处恢复默认表单
for (let key in form) {
form[key] = ''
}
}
}
const getTheTree = () => {
queryAllAlgorithmLibrary().then(res => {
res.data.forEach((item: any) => {
item.children.forEach((item2: any) => {
item2.childrens = item2.children
item2.children = []
})
})
dataTree.value = res.data
})
}
const submit = () => {
formRef.value.validate(async (valid: boolean) => {
if (valid) {
addAlgorithm({
pid: form.pid.length == 0 ? '' : form.pid,
name: form.name
}).then(res => {
ElMessage.success('新增成功')
emit('getTree')
dialogVisible.value = false
})
}
})
}
defineExpose({ open })
</script>

View File

@@ -2,21 +2,19 @@
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="700px"> <el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="700px">
<el-scrollbar> <el-scrollbar>
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef"> <el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef">
<el-form-item label="算法名称"> <el-form-item label="算法名称" prop="name">
<el-input v-model="form.name" placeholder="请输入算法名称" /> <el-input v-model="form.name" placeholder="请输入算法名称" />
</el-form-item> </el-form-item>
<el-form-item label="定义"> <el-form-item label="计算周期" prop="period">
<el-input v-model="form.code" placeholder="请输入定义" /> <el-select v-model="form.period" placeholder="请选择计算周期" clearable>
<el-option v-for="item in cycle" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="计算公式"> <el-form-item label="数据来源" prop="source">
<el-input v-model="form.remark" :rows="2" type="textarea" placeholder="请输入计算公式" /> <el-input v-model="form.source" placeholder="请输入数据来源" />
</el-form-item> </el-form-item>
<el-form-item label="定义" prop="definition">
<el-form-item label="计算周期"> <el-input v-model="form.definition" :rows="2" type="textarea" placeholder="请输入定义" />
<el-input v-model="form.code" placeholder="请输入计算周期" />
</el-form-item>
<el-form-item label="数据来源">
<el-input v-model="form.code" placeholder="请输入数据来源" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-scrollbar> </el-scrollbar>
@@ -32,50 +30,66 @@
import { ref, inject } from 'vue' import { ref, inject } from 'vue'
import { reactive } from 'vue' import { reactive } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删除 import { addAlgorithm, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
const emit = defineEmits(['getTree'])
const dialogVisible = ref(false) const dialogVisible = ref(false)
const title = ref('') const title = ref('')
const tableStore = inject('tableStore') as TableStore
const formRef = ref() const formRef = ref()
const List = ref({})
// 注意不要和表单ref的命名冲突 // 注意不要和表单ref的命名冲突
const form = reactive<anyObj>({ const form = reactive<anyObj>({
code: '',
name: '', name: '',
remark: '', period: '',
id: '' definition: '',
source: ''
}) })
const rules = { const rules = {
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '请输入算法名称', trigger: 'blur' }],
code: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }] period: [{ required: true, message: '请选择计算周期', trigger: 'change' }],
definition: [{ required: true, message: '请输入定义', trigger: 'blur' }],
source: [{ required: true, message: '请输入数据来源', trigger: 'blur' }]
} }
const cycle = [
{ value: '0', label: '日' },
{ value: '1', label: '月' },
{ value: '2', label: '季' },
{ value: '3', label: '年' }
]
const open = (text: string, data?: anyObj) => { const open = (row: any) => {
title.value = text title.value = row.title
dialogVisible.value = true dialogVisible.value = true
if (data) { List.value = row.row
// 表单赋值 if (row.title == '新增算法') {
for (let key in form) {
form[key] = data[key]
}
} else {
// 在此处恢复默认表单 // 在此处恢复默认表单
for (let key in form) { for (let key in form) {
form[key] = '' form[key] = ''
} }
} else {
// 表单赋值
for (let key in form) {
form[key] = row.row[key]
}
form.id = row.row.id
} }
} }
const submit = () => { const submit = () => {
formRef.value.validate(async (valid: boolean) => { formRef.value.validate(async (valid: boolean) => {
if (valid) { if (valid) {
if (form.id) { if (title.value == '新增算法') {
// await update(form) // await update(form)
addAlgorithm({ ...form, pid: List.value?.id }).then(res => {
ElMessage.success('新增成功')
dialogVisible.value = false
emit('getTree')
})
} else { } else {
// await create(form) updateAlgorithmLibrary(form).then(res => {
ElMessage.success('修改成功')
dialogVisible.value = false
emit('getTree')
})
} }
ElMessage.success('保存成功')
tableStore.index()
dialogVisible.value = false
} }
}) })
} }

View File

@@ -4,155 +4,190 @@
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes"> <splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
<pane :size="size"> <pane :size="size">
<algorithmTree <algorithmTree
ref="treeRef"
:default-expand-all="false" :default-expand-all="false"
:default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []" :default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []"
:current-node-key="monitoringPoint.state.lineId" :current-node-key="monitoringPoint.state.lineId"
@node-click="handleNodeClick" @node-click="handleNodeClick"
@init="handleNodeClick" @init="handleNodeClick"
@onAddTree="onAddTree"
></algorithmTree> ></algorithmTree>
</pane> </pane>
<pane style="background: #fff" :style="height"> <pane style="background: #fff" :style="height">
<!-- <div :style="height"></div> --> <div class="boxTop">
<TableHeader ref="TableHeaderRef" :show-search="false"> <div>
<template v-slot:select> <el-radio-group v-model="radio">
<el-radio-group v-model="tableStore.table.params.radio2" @change="tableStore.index()"> <el-radio-button v-for="(item, i) in dotList?.childrens" :label="item.name" :value="i" />
<el-radio-button label="监测覆盖率" value="1" />
<el-radio-button label="装置在线率" value="2" />
<el-radio-button label="数据完整性" value="3" />
</el-radio-group> </el-radio-group>
</template> </div>
<template #operation> <div>
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</el-button> <el-button
</template> icon="el-icon-Plus"
</TableHeader> type="primary"
<Table ref="tableRef"></Table> @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> </pane>
</splitpanes> </splitpanes>
<!-- 树弹框 -->
<addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" />
<!-- 弹框 --> <!-- 弹框 -->
<PopupEdit ref="popupEditRef" /> <PopupEdit ref="popupEditRef" @getTree="treeRef.loadData(dotList.id)" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, provide } from 'vue' import { onMounted, ref, provide } from 'vue'
import 'splitpanes/dist/splitpanes.css' import 'splitpanes/dist/splitpanes.css'
import { Splitpanes, Pane } from 'splitpanes' import { Splitpanes, Pane } from 'splitpanes'
import TableStore from '@/utils/tableStore'
import algorithmTree from '@/components/tree/pqs/algorithmTree.vue' import algorithmTree from '@/components/tree/pqs/algorithmTree.vue'
import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout' 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 { getLineExport, getList, selectReleation } from '@/api/event-boot/report'
import addTree from './components/addTree.vue'
import PopupEdit from './components/form.vue' import PopupEdit from './components/form.vue'
import { useMonitoringPoint } from '@/stores/monitoringPoint' 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({ defineOptions({
name: 'database/algorithm' name: 'database/algorithm'
}) })
const monitoringPoint = useMonitoringPoint() const monitoringPoint = useMonitoringPoint()
const height = mainHeight(20) const height = mainHeight(20)
const heightTab = mainHeight(82)
const size = ref(0) const size = ref(0)
const addTreeRef = ref()
const treeRef = ref()
const popupEditRef = ref() const popupEditRef = ref()
const TableHeaderRef = ref() const TableHeaderRef = ref()
const dotList: any = ref({ const dotList: any = ref()
name: monitoringPoint.state.lineName.split('>')[3],
id: monitoringPoint.state.lineId,
level: 6
})
const templatePolicy: any = ref([]) const templatePolicy: any = ref([])
const tableStore = new TableStore({ // const tableStore = new TableStore({
url: '/user-boot/dept/deptTree', // url: '/supervision-boot/libalgorithm/queryAllAlgorithmLibrary',
method: 'POST', // method: 'GET',
column: [ // column: [
{ title: '算法名称', field: 'name' }, // { title: '算法名称', field: 'name' },
{ // {
title: '定义', // title: '定义',
field: 'name1' // field: 'name1'
}, // },
{ // {
title: '计算公式', // title: '计算公式',
field: 'name2' // field: 'name2'
}, // },
{ // {
title: '计算周期', // title: '计算周期',
field: 'name3' // field: 'name3'
}, // },
{ // {
title: '数据来源', // title: '数据来源',
field: 'name4' // field: 'name4'
}, // },
{ // {
title: '是否启用', // title: '是否启用',
field: 'name5', // field: 'name5',
render: 'tag', // render: 'tag',
effect: 'dark', // effect: 'dark',
custom: { // custom: {
0: 'info', // 0: 'info',
1: 'success' // 1: 'success'
}, // },
replaceValue: { // replaceValue: {
0: '否', // 0: '否',
1: '是' // 1: '是'
} // }
} // }
// ],
// { // loadCallback: () => {}
// title: '操作', // })
// align: 'center', const radio = ref(0)
// 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 addUser = () => { const addUser = () => {
popupEditRef.value.open('新增算法') popupEditRef.value.open({
title: '新增算法',
row: dotList.value?.childrens[radio.value]
})
} }
provide('tableStore', tableStore)
onMounted(() => { onMounted(() => {
const dom = document.getElementById('navigation-splitpanes') const dom = document.getElementById('navigation-splitpanes')
if (dom) { if (dom) {
size.value = Math.round((180 / dom.offsetHeight) * 100) size.value = Math.round((180 / dom.offsetHeight) * 100)
} }
tableStore.index() // tableStore.index()
}) })
const handleNodeClick = (data: any, node: any) => { 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> </script>
<style lang="scss"> <style lang="scss">
@@ -162,22 +197,7 @@ const handleNodeClick = (data: any, node: any) => {
.grid-content { .grid-content {
text-align: center; 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 { .el-divider--horizontal {
margin: 10px 0; margin: 10px 0;
} }
@@ -185,4 +205,10 @@ const handleNodeClick = (data: any, node: any) => {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
} }
.boxTop {
height: 52px;
padding: 10px 10px 10px 0;
display: flex;
justify-content: space-between;
}
</style> </style>

View File

@@ -257,7 +257,7 @@ onMounted(() => {
const checkboxConfig = reactive<VxeTablePropTypes.CheckboxConfig>({ const checkboxConfig = reactive<VxeTablePropTypes.CheckboxConfig>({
labelField: '', labelField: '',
checkMethod: ({ row }) => { checkMethod: ({ row }) => {
return !(row.testRunState == 1 || row.testRunState == 2) return adminInfo.roleCode.includes('delete_info') || !(row.testRunState == 1 || row.testRunState == 2)
} }
}) })
const deleteEven = () => { const deleteEven = () => {