|
@@ -30,7 +30,7 @@
|
|
|
</CusForm>
|
|
|
<template v-if="state.tab == 1">
|
|
|
<div class="tree-title">
|
|
|
- 全部规则(0)
|
|
|
+ 全部规则({{ ruleTotalCpt }})
|
|
|
<div class="expend-tree __hover" @click="expendRules">{{rulesExpandAllCpt ? '收起' : '展开'}}全部</div>
|
|
|
</div>
|
|
|
<el-tree
|
|
@@ -39,17 +39,21 @@
|
|
|
:data="state.rulesList"
|
|
|
:props="ruleProps"
|
|
|
node-key="id"
|
|
|
+ :filter-node-method="ruleFilterNode"
|
|
|
>
|
|
|
<template #default="{ node, data }">
|
|
|
<span class="custom-tree-node">
|
|
|
<span>{{ node.label }}</span>
|
|
|
- <span v-if="node.level > 1">
|
|
|
- <SvgIcon name="edit" size="12" class="__hover" @click.stop="onAddRule(data)"/>
|
|
|
- <SvgIcon name="detail_1" size="12" class="__hover" @click.stop="onAddRule(data)"/>
|
|
|
- <el-switch v-model="data.active" size="small"/>
|
|
|
- </span>
|
|
|
- <span v-else>
|
|
|
- <SvgIcon name="add" size="12" class="__hover" @click.stop="onAddRule(data)"/>
|
|
|
+ <span class="tree-buttons">
|
|
|
+ <template v-if="node.level > 1">
|
|
|
+ <SvgIcon name="edit" size="12" class="__hover" @click.stop="onAddRule(data)"/>
|
|
|
+ <SvgIcon name="detail_1" size="12" class="__hover" @click.stop="onAddRule(data)"/>
|
|
|
+ <el-switch v-model="data.active" size="small"/>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <div class="img-button __hover" @click.stop="onAddRule(data)"><img src="@/assets/images/web/tree-add.png"/></div>
|
|
|
+ <div class="img-button __hover" @click.stop="onViewModel(data)"><img src="@/assets/images/web/tree-view.png"/></div>
|
|
|
+ </template>
|
|
|
</span>
|
|
|
</span>
|
|
|
</template>
|
|
@@ -57,8 +61,8 @@
|
|
|
</template>
|
|
|
<template v-else-if="state.tab == 2">
|
|
|
<div class="tree-title">
|
|
|
- 全部区域(0)
|
|
|
- <div class="expend-tree __hover" @click="onAddArea"><img src="@/assets/images/web/tree-add.png"/></div>
|
|
|
+ 全部区域({{ state.areaList.length }})
|
|
|
+ <div class="expend-tree img-button __hover" @click="onAddArea"><img src="@/assets/images/web/tree-add.png"/></div>
|
|
|
</div>
|
|
|
<el-tree
|
|
|
ref="ref_areaTree"
|
|
@@ -85,6 +89,7 @@
|
|
|
</el-tree>
|
|
|
</template>
|
|
|
<ruleDetail v-model:show="state.ruleDetail.show" :transfer="state.ruleDetail.transfer"/>
|
|
|
+ <modelDetail v-model:show="state.modelDetail.show" :transfer="state.modelDetail.transfer"/>
|
|
|
</div>
|
|
|
</DragWindow>
|
|
|
</template>
|
|
@@ -94,7 +99,6 @@ import {computed, getCurrentInstance, markRaw, onMounted, reactive, ref, watch}
|
|
|
import ruleDetail from "./rule-detail.vue";
|
|
|
import areaForm from "./area-form.vue";
|
|
|
import DragWindow from '../components/drag-window.vue'
|
|
|
-import { Search, Refresh } from "@element-plus/icons-vue";
|
|
|
import {warnAreaDelete, warnAreaQueryAll} from "@/api/modules/web/area";
|
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
import * as layer from "ol/layer";
|
|
@@ -102,6 +106,7 @@ import * as format from "ol/format";
|
|
|
import * as source from "ol/source";
|
|
|
import * as style from "ol/style";
|
|
|
import {warnModelRuleTree} from "@/api/modules/web/rule";
|
|
|
+import modelDetail from './model-detail.vue'
|
|
|
|
|
|
const {proxy} = getCurrentInstance()
|
|
|
const emit = defineEmits(['update:show'])
|
|
@@ -117,7 +122,7 @@ const state: any = reactive({
|
|
|
left: 85,
|
|
|
top: 110
|
|
|
},
|
|
|
- tab: 2,
|
|
|
+ tab: 1,
|
|
|
loading: false,
|
|
|
text: '',
|
|
|
textReal: '',
|
|
@@ -126,11 +131,16 @@ const state: any = reactive({
|
|
|
transfer: {},
|
|
|
show: false
|
|
|
},
|
|
|
+ modelDetail: {
|
|
|
+ transfer: {},
|
|
|
+ show: false
|
|
|
+ },
|
|
|
areaList: [],
|
|
|
areaLayer: null
|
|
|
})
|
|
|
const ruleProps = {
|
|
|
- children: 'children'
|
|
|
+ children: 'ruleList',
|
|
|
+ label: 'name'
|
|
|
}
|
|
|
const areaProps = {
|
|
|
children: 'children',
|
|
@@ -148,7 +158,11 @@ const initData = () => {
|
|
|
state.loading = true
|
|
|
if (state.tab == 1) {
|
|
|
warnModelRuleTree().then(res => {
|
|
|
-
|
|
|
+ state.rulesList = res.data
|
|
|
+ setTimeout(() => {
|
|
|
+ ref_rulesTree.value?.filter(state.textReal)
|
|
|
+ state.loading = false
|
|
|
+ }, 100)
|
|
|
})
|
|
|
} else {
|
|
|
warnAreaQueryAll().then(res => {
|
|
@@ -277,6 +291,23 @@ const areaFilterNode = (value, data) => {
|
|
|
if (!value) return true
|
|
|
return data.name?.includes(value)
|
|
|
}
|
|
|
+const ruleFilterNode = (value, data) => {
|
|
|
+ if (!value) return true
|
|
|
+ return data.name?.includes(value)
|
|
|
+}
|
|
|
+const onViewModel = (row) => {
|
|
|
+ state.modelDetail.transfer = {
|
|
|
+ id: row.id
|
|
|
+ }
|
|
|
+ state.modelDetail.show = true
|
|
|
+}
|
|
|
+const ruleTotalCpt = computed(() => {
|
|
|
+ let total = 0
|
|
|
+ state.rulesList.forEach(v => {
|
|
|
+ total += v[ruleProps.children]?.length || 0
|
|
|
+ })
|
|
|
+ return total
|
|
|
+})
|
|
|
watch(() => state.textReal, (n) => {
|
|
|
if (state.tab == 1) {
|
|
|
ref_rulesTree.value?.filter(n)
|
|
@@ -414,4 +445,14 @@ $mapHeight: var(--easy-map-height);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.img-button {
|
|
|
+ width: 20px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ >img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|