feat: entity列表(部分)、css架构更改
This commit is contained in:
@@ -60,21 +60,62 @@ export const entityType = {
|
||||
}
|
||||
|
||||
export const entityFilterType = {
|
||||
ip: {
|
||||
country: 'locate_country',
|
||||
region: 'locate_region',
|
||||
asn: 'asn'
|
||||
},
|
||||
domain: {
|
||||
categoryGroup: 'category_group',
|
||||
categoryName: 'category_name',
|
||||
reputationLevel: 'reputation_level'
|
||||
},
|
||||
app: {
|
||||
appCategory: 'app_category',
|
||||
appSubcategory: 'app_subcategory',
|
||||
appRisk: 'app_risk'
|
||||
}
|
||||
ip: [
|
||||
{
|
||||
column: 'country_distinct_count',
|
||||
labelI18nCode: 'overall.country',
|
||||
icon: 'cn-icon cn-icon-country'
|
||||
},
|
||||
{
|
||||
column: 'province_distinct_count',
|
||||
labelI18nCode: 'overall.province',
|
||||
icon: 'cn-icon cn-icon-position'
|
||||
},
|
||||
{
|
||||
column: 'city_distinct_count',
|
||||
labelI18nCode: 'overall.city',
|
||||
icon: 'el-icon-s-home'
|
||||
},
|
||||
{
|
||||
column: 'asn_distinct_count',
|
||||
labelI18nCode: 'entities.asn',
|
||||
icon: 'cn-icon cn-icon-cloud'
|
||||
}
|
||||
],
|
||||
domain: [
|
||||
{
|
||||
column: 'category_group_distinct_count',
|
||||
labelI18nCode: 'entities.domainDetail.categoryGroup',
|
||||
icon: 'cn-icon cn-icon-category'
|
||||
},
|
||||
{
|
||||
column: 'category_distinct_count',
|
||||
labelI18nCode: 'entities.category',
|
||||
icon: 'cn-icon cn-icon-sub-category'
|
||||
},
|
||||
{
|
||||
column: 'category_group_distinct_count',
|
||||
labelI18nCode: 'entities.reputationLevel',
|
||||
icon: 'cn-icon cn-icon-credit'
|
||||
}
|
||||
],
|
||||
app: [
|
||||
{
|
||||
column: 'category_distinct_count',
|
||||
labelI18nCode: 'entities.category',
|
||||
icon: 'cn-icon cn-icon-category'
|
||||
},
|
||||
{
|
||||
column: 'subcategory_distinct_count',
|
||||
labelI18nCode: 'entities.subcategory',
|
||||
icon: 'cn-icon cn-icon-sub-category'
|
||||
},
|
||||
{
|
||||
column: 'risk_distinct_count',
|
||||
labelI18nCode: 'entities.risk',
|
||||
icon: 'cn-icon cn-icon-risk'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export const unitTypes = {
|
||||
|
||||
@@ -4,6 +4,7 @@ import _ from 'lodash'
|
||||
import { storageKey, iso36112 } from '@/utils/constants'
|
||||
import { getIso36112JsonData } from '@/utils/api'
|
||||
import { format } from 'echarts'
|
||||
import router from '@/router'
|
||||
|
||||
export const tableSort = {
|
||||
// 是否需要排序
|
||||
@@ -250,11 +251,10 @@ export const tableSort = {
|
||||
export const cancelWithChange = {
|
||||
mounted (el, binding) {
|
||||
if (!binding.value || !binding.value.object) return
|
||||
const unsavedChange = localStorage.getItem('cn-unsaved-change')
|
||||
const oldValue = JSON.parse(JSON.stringify(binding.value.object))
|
||||
function domClick (e) {
|
||||
const newValue = JSON.parse(JSON.stringify(binding.value.object))
|
||||
if (unsavedChange === 'on' && !isEqual(oldValue, newValue)) {
|
||||
if (!isEqual(oldValue, newValue)) {
|
||||
ElMessageBox.confirm(i18n.global.t('tip.confirmCancel'), {
|
||||
confirmButtonText: i18n.global.t('tip.yes'),
|
||||
cancelButtonText: i18n.global.t('tip.no'),
|
||||
@@ -281,15 +281,13 @@ export const cancelWithChange = {
|
||||
const exceptClassName = ['prevent-click-outside'] // clickOutside排除的class(白名单)
|
||||
export const clickOutside = {
|
||||
// 初始化指令
|
||||
mounted (el, binding) {
|
||||
if (!binding.expression) return
|
||||
const unsavedChange = localStorage.getItem('cn-unsaved-change')
|
||||
let oldValue
|
||||
beforeMount (el, binding) {
|
||||
/* let oldValue
|
||||
try {
|
||||
oldValue = JSON.parse(JSON.stringify(binding.value.object))
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
} */
|
||||
function documentHandler (e) {
|
||||
if (el.contains(e.target)) {
|
||||
return false
|
||||
@@ -299,7 +297,7 @@ export const clickOutside = {
|
||||
// eslint-disable-next-line no-labels
|
||||
top: for (let i = 0; i < path.length; i++) {
|
||||
for (let j = 0; j < exceptClassName.length; j++) {
|
||||
if (path[i].className && path[i].className.indexOf && path[i].className.indexOf(exceptClassName[j]) !== -1) {
|
||||
if (path[i].className && path[i].className.indexOf(exceptClassName[j]) !== -1) {
|
||||
flag = false
|
||||
// eslint-disable-next-line no-labels
|
||||
break top
|
||||
@@ -309,9 +307,10 @@ export const clickOutside = {
|
||||
if (!flag) {
|
||||
return false
|
||||
}
|
||||
if (oldValue) {
|
||||
binding.value()
|
||||
/* if (oldValue) {
|
||||
const newValue = JSON.parse(JSON.stringify(binding.value.oldValue))
|
||||
if (unsavedChange === 'on' && !isEqual(oldValue, newValue)) {
|
||||
if (!isEqual(oldValue, newValue)) {
|
||||
ElMessageBox.confirm('Confirm?', { // TODO 国际化
|
||||
confirmButtonText: 'Yes', // TODO 国际化
|
||||
cancelButtonText: 'No', // TODO 国际化
|
||||
@@ -332,17 +331,17 @@ export const clickOutside = {
|
||||
binding.value(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
// 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听
|
||||
el.__vueClickOutside__ = documentHandler
|
||||
document.addEventListener('mousedown', documentHandler)
|
||||
document.addEventListener('click', documentHandler)
|
||||
},
|
||||
unmounted (el, binding) {
|
||||
// 解除事件监听
|
||||
document.removeEventListener('mousedown', el.__vueClickOutside__)
|
||||
document.removeEventListener('click', el.__vueClickOutside__)
|
||||
delete el.__vueClickOutside__
|
||||
}
|
||||
}
|
||||
@@ -497,3 +496,7 @@ export function copyValue (item) {
|
||||
creatDom.parentNode.removeChild(creatDom)
|
||||
ElMessage.success(i18n.global.t('tip.copySuccess'))
|
||||
}
|
||||
|
||||
export function getCurrentRoute () {
|
||||
return router.currentRoute && router.currentRoute.path
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user