类型配置

This commit is contained in:
仲么了
2024-01-16 15:48:32 +08:00
parent f0f980ce60
commit 7da7f5d803

View File

@@ -58,14 +58,14 @@
<template #default="{ node, data }"> <template #default="{ node, data }">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<div class="hide-txt">{{ data.label }}</div> <div class="hide-txt">{{ data.label }}</div>
<template v-if="!node.isLeaf"> <template v-if="node.level === 1">
<div class="ml5">({{ data.children.length }})</div> <div class="ml5">({{ data.children.length }})</div>
<div style="flex: 1"></div> <div style="flex: 1"></div>
<i <el-popconfirm title="确定删除该分组吗?" @confirm="deleteStatisticalGroup(data)">
class="el-icon-delete ml10" <template #reference>
style="cursor: pointer" <Icon name="el-icon-Delete" class="ml10" style="cursor: pointer"></Icon>
@click="deleteStatistical(data)" </template>
></i> </el-popconfirm>
</template> </template>
</div> </div>
</template> </template>
@@ -81,14 +81,14 @@
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
<PopupAdd ref='addRef' @over='init'></PopupAdd> <PopupAdd ref="addRef" @over="init"></PopupAdd>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, inject } from 'vue' import { ref, inject } from 'vue'
import { ElMessage } from 'element-plus' import { CascaderValue, ElMessage } from 'element-plus'
import { queryStatistical } from '@/api/system-boot/csstatisticalset' import { addStatistical, queryStatistical } from '@/api/system-boot/csstatisticalset'
import PopupAdd from './add.vue' import PopupAdd from './add.vue'
import { deleteStatistical } from '@/api/system-boot/dic'
defineOptions({ defineOptions({
name: 'govern/setting/statisticalType/binding' name: 'govern/setting/statisticalType/binding'
}) })
@@ -98,9 +98,9 @@ const pid = ref('')
const dialogVisible = ref(false) const dialogVisible = ref(false)
const popoverVisible = ref(false) const popoverVisible = ref(false)
const fromData = ref<treeData[]>([]) const fromData = ref<treeData[]>([])
const fromDataValue = ref<treeData[]>([]) const fromDataValue = ref<string[]>([])
const toData = ref<treeData[]>([]) const toData = ref<treeData[]>([])
const toDataValue = ref<treeData[]>([]) const toDataValue = ref<string[]>([])
const init = () => { const init = () => {
queryStatistical(pid.value).then(res => { queryStatistical(pid.value).then(res => {
@@ -225,24 +225,14 @@ const rightCheckChange = () => {
}) })
} }
const deleteStatistical = (data: any) => { const deleteStatisticalGroup = (data: any) => {
if (data.children.length) { if (data.children.length) {
return ElMessage.warning('该分组下有指标,不能删除') return ElMessage.warning('该分组下有指标,不能删除')
} }
// $confirm.value('确定删除该分组吗?', '提示', { deleteStatistical(data.value).then(res => {
// confirmButtonText: '确定', ElMessage.success('删除成功')
// cancelButtonText: '取消', toData.value = toData.value.filter(item => item.value !== data.value)
// type: 'warning' })
// }).then(() => {
// deleteStatistical(data.value).then(res => {
// if (res.code == 'A0000') {
// $message.value.success('删除成功')
// toData.value = toData.value.filter(item => item.value !== data.value)
// } else {
// $message.value.error(res.msg)
// }
// })
// })
} }
const newGroup = () => { const newGroup = () => {
@@ -262,7 +252,32 @@ const open = (id: string) => {
init() init()
} }
const submit = async () => { const submit = async () => {
let ids = []
let one = {
id: pid.value,
ids: [] as any[]
}
toData.value.forEach(item => {
let obj = {
id: item.id,
ids: [] as any[]
}
if (item.children) {
item.children.forEach(item2 => {
obj.ids.push(item2.value)
})
ids.push(obj)
} else {
one.ids.push(item.value)
}
})
if (one.ids.length) {
ids.push(one)
}
addStatistical(ids).then(res => {
ElMessage.success('绑定指标成功')
dialogVisible.value = false dialogVisible.value = false
})
} }
defineExpose({ open }) defineExpose({ open })