类型配置
This commit is contained in:
@@ -58,14 +58,14 @@
|
||||
<template #default="{ node, data }">
|
||||
<div style="display: flex; align-items: center">
|
||||
<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 style="flex: 1"></div>
|
||||
<i
|
||||
class="el-icon-delete ml10"
|
||||
style="cursor: pointer"
|
||||
@click="deleteStatistical(data)"
|
||||
></i>
|
||||
<el-popconfirm title="确定删除该分组吗?" @confirm="deleteStatisticalGroup(data)">
|
||||
<template #reference>
|
||||
<Icon name="el-icon-Delete" class="ml10" style="cursor: pointer"></Icon>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -81,14 +81,14 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<PopupAdd ref='addRef' @over='init'></PopupAdd>
|
||||
<PopupAdd ref="addRef" @over="init"></PopupAdd>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
|
||||
import { CascaderValue, ElMessage } from 'element-plus'
|
||||
import { addStatistical, queryStatistical } from '@/api/system-boot/csstatisticalset'
|
||||
import PopupAdd from './add.vue'
|
||||
|
||||
import { deleteStatistical } from '@/api/system-boot/dic'
|
||||
defineOptions({
|
||||
name: 'govern/setting/statisticalType/binding'
|
||||
})
|
||||
@@ -98,9 +98,9 @@ const pid = ref('')
|
||||
const dialogVisible = ref(false)
|
||||
const popoverVisible = ref(false)
|
||||
const fromData = ref<treeData[]>([])
|
||||
const fromDataValue = ref<treeData[]>([])
|
||||
const fromDataValue = ref<string[]>([])
|
||||
const toData = ref<treeData[]>([])
|
||||
const toDataValue = ref<treeData[]>([])
|
||||
const toDataValue = ref<string[]>([])
|
||||
|
||||
const init = () => {
|
||||
queryStatistical(pid.value).then(res => {
|
||||
@@ -225,24 +225,14 @@ const rightCheckChange = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const deleteStatistical = (data: any) => {
|
||||
const deleteStatisticalGroup = (data: any) => {
|
||||
if (data.children.length) {
|
||||
return ElMessage.warning('该分组下有指标,不能删除')
|
||||
}
|
||||
// $confirm.value('确定删除该分组吗?', '提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// 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)
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
deleteStatistical(data.value).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
toData.value = toData.value.filter(item => item.value !== data.value)
|
||||
})
|
||||
}
|
||||
|
||||
const newGroup = () => {
|
||||
@@ -262,7 +252,32 @@ const open = (id: string) => {
|
||||
init()
|
||||
}
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
|
||||
Reference in New Issue
Block a user