fix: source和entity integration添加查看功能

This commit is contained in:
刘洪洪
2024-11-21 18:06:56 +08:00
parent e4b20edb7a
commit 4062a604c7
9 changed files with 92 additions and 27 deletions

View File

@@ -128,6 +128,12 @@
} }
} }
.tool-btn-view {
i {
font-size: 13px;
}
}
.btn-customize { .btn-customize {
color: var(--el-color-primary); color: var(--el-color-primary);
font-size: 12px; font-size: 12px;

View File

@@ -14,7 +14,6 @@
:resizable="false" :resizable="false"
align="center" align="center"
type="selection" type="selection"
:selectable="checkSelectable"
width="55"> width="55">
</el-table-column> </el-table-column>
<el-table-column <el-table-column

View File

@@ -14,7 +14,6 @@
:resizable="false" :resizable="false"
align="center" align="center"
type="selection" type="selection"
:selectable="checkSelectable"
width="55"> width="55">
</el-table-column> </el-table-column>
<el-table-column <el-table-column

View File

@@ -42,6 +42,7 @@ export default {
delFlag: false, delFlag: false,
disableEdit: true, // 编辑按钮是否不可用,当选择多条记录的时候,编辑按钮不可用 disableEdit: true, // 编辑按钮是否不可用,当选择多条记录的时候,编辑按钮不可用
disableDelete: true, disableDelete: true,
disableView: true,
operationWidth: '165', // 操作列宽 operationWidth: '165', // 操作列宽
loading: true, loading: true,
isNoData: false isNoData: false
@@ -91,12 +92,18 @@ export default {
} }
}) })
this.disableEdit = this.batchDeleteObjs.length !== 1 this.disableEdit = this.batchDeleteObjs.length !== 1
this.disableView = this.batchDeleteObjs.length !== 1
this.disableDelete = this.batchDeleteObjs.length < 1 this.disableDelete = this.batchDeleteObjs.length < 1
const obj = objs.find(d => d.usage > 0) const obj = objs.find(d => d.usage > 0)
if (obj) { if (obj) {
this.disableDelete = true this.disableDelete = true
this.disableEdit = true this.disableEdit = true
} }
const obj1 = objs.find(d => d.isBuiltIn > 0)
if (obj1) {
this.disableDelete = true
this.disableEdit = true
}
}, },
getTableData (params, isAll, isClearType) { getTableData (params, isAll, isClearType) {
if (isAll) { if (isAll) {

View File

@@ -197,15 +197,17 @@ export function handleComponent (code) {
case 'locationMap': case 'locationMap':
case 'traceTracking': case 'traceTracking':
return () => import('@/views/location/Index') return () => import('@/views/location/Index')
case 'source': case 'dataSource':
return () => import('@/views/setting/sources/Sources') return () => import('@/views/setting/sources/Sources')
case 'createSource': case 'createDataSource':
case 'editSource': case 'editDataSource':
case 'viewDataSource':
return () => import('@/views/setting/sources/SourcesForm') return () => import('@/views/setting/sources/SourcesForm')
case 'entitySetting': case 'entityIntegration':
return () => import('@/views/setting/entitySetting/EntitySetting') return () => import('@/views/setting/entitySetting/EntitySetting')
case 'createEntitySetting': case 'createEntityIntegration':
case 'editEntitySetting': case 'editEntityIntegration':
case 'viewEntityIntegration':
return () => import('@/views/setting/entitySetting/EntitySettingForm') return () => import('@/views/setting/entitySetting/EntitySettingForm')
default: default:
return null return null

View File

@@ -22,6 +22,12 @@
<i class="cn-icon-edit cn-icon"></i> <i class="cn-icon-edit cn-icon"></i>
<span>{{ $t('overall.edit') }}</span> <span>{{ $t('overall.edit') }}</span>
</button> </button>
<button id="tag-view" class="business-button business-button--light tag__btn margin-r-10 tool-btn-view"
:disabled="disableView"
@click="viewEntity">
<i class="cn-icon-preview cn-icon"></i>
<span>{{ $t('overall.view') }}</span>
</button>
<button id="tag-delete" class="business-button business-button--light tag__btn margin-r-10" <button id="tag-delete" class="business-button business-button--light tag__btn margin-r-10"
:disabled="disableDelete" :disabled="disableDelete"
@click="delBatch"> @click="delBatch">
@@ -117,7 +123,7 @@ export default {
}, },
add () { add () {
this.$router.push({ this.$router.push({
path: '/setting/entitySetting/create', path: '/setting/entityIntegration/create',
query: { query: {
t: +new Date() t: +new Date()
} }
@@ -216,10 +222,21 @@ export default {
this.jumpToEditPage(this.batchDeleteObjs[0].id) this.jumpToEditPage(this.batchDeleteObjs[0].id)
} }
}, },
viewEntity () {
const pageNo = this.$router.currentRoute.value.query.pageNo
this.$router.push({
path: '/setting/entityIntegration/view',
query: {
t: +new Date(),
pageNoForTable: pageNo || 1,
id: this.batchDeleteObjs[0].id
}
})
},
jumpToEditPage (id) { jumpToEditPage (id) {
const pageNo = this.$router.currentRoute.value.query.pageNo const pageNo = this.$router.currentRoute.value.query.pageNo
this.$router.push({ this.$router.push({
path: '/setting/entitySetting/edit', path: '/setting/entityIntegration/edit',
query: { query: {
t: +new Date(), t: +new Date(),
pageNoForTable: pageNo || 1, pageNoForTable: pageNo || 1,

View File

@@ -2,10 +2,7 @@
<div class="es-form"> <div class="es-form">
<loading :loading="myLoading"></loading> <loading :loading="myLoading"></loading>
<div class="es-form-header"> <div class="es-form-header">{{ $t('overall.entitySetting') }}</div>
<!-- {{ ruleId ? $t('detection.editEventPolicies') : $t('overall.entitySetting') }}-->
{{ $t('overall.entitySetting') }}
</div>
<div class="es-form-content"> <div class="es-form-content">
<!--第一步General Settings--> <!--第一步General Settings-->
@@ -202,7 +199,7 @@
<button class="business-button business-button--light tag__btn" @click="cancel"> <button class="business-button business-button--light tag__btn" @click="cancel">
<span>{{ $t('overall.cancel') }}</span> <span>{{ $t('overall.cancel') }}</span>
</button> </button>
<button style="position: relative;" class="business-button tag__btn" :disabled="editObj.isBuiltIn>0" @click="saveEntity"> <button style="position: relative;" class="business-button tag__btn" :disabled="disabledSave" @click="saveEntity">
<!-- <loading :loading="blockOperation.save"></loading>--> <!-- <loading :loading="blockOperation.save"></loading>-->
<span>{{ $t('overall.save') }}</span> <span>{{ $t('overall.save') }}</span>
</button> </button>
@@ -268,6 +265,11 @@ export default {
components: { components: {
Loading Loading
}, },
computed: {
disabledSave () {
return this.editObj.isBuiltIn > 0 || this.isView
}
},
mounted () { mounted () {
this.initSourceData() this.initSourceData()
if (this.ruleId) { if (this.ruleId) {
@@ -275,7 +277,7 @@ export default {
} }
}, },
setup () { setup () {
const { query } = useRoute() const { query, name } = useRoute()
const ruleId = ref(query.id || '') const ruleId = ref(query.id || '')
const pageNoForTable = ref(query.pageNoForTable || 1) const pageNoForTable = ref(query.pageNoForTable || 1)
const myLoading = ref(!!ruleId.value) const myLoading = ref(!!ruleId.value)
@@ -306,12 +308,14 @@ export default {
enable: 1 enable: 1
}) })
const isView = name === 'viewEntityIntegration'
return { return {
ruleId, ruleId,
myLoading, myLoading,
pageNoForTable, pageNoForTable,
editObj, editObj,
ruleObj ruleObj,
isView
} }
}, },
methods: { methods: {
@@ -340,7 +344,7 @@ export default {
console.error(e) console.error(e)
this.$message.error(this.errorMsgHandler(e)) this.$message.error(this.errorMsgHandler(e))
this.$router.push({ this.$router.push({
path: '/setting/entitySetting', path: '/setting/entityIntegration',
query: { query: {
pageNo: this.pageNoForTable ? Number(this.pageNoForTable) : 1, pageNo: this.pageNoForTable ? Number(this.pageNoForTable) : 1,
t: +new Date() t: +new Date()
@@ -381,7 +385,7 @@ export default {
console.error(e) console.error(e)
this.$message.error(this.errorMsgHandler(e)) this.$message.error(this.errorMsgHandler(e))
this.$router.push({ this.$router.push({
path: '/setting/entitySetting', path: '/setting/entityIntegration',
query: { query: {
pageNo: this.pageNoForTable ? Number(this.pageNoForTable) : 1, pageNo: this.pageNoForTable ? Number(this.pageNoForTable) : 1,
t: +new Date() t: +new Date()
@@ -643,7 +647,7 @@ export default {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.$router.push({ this.$router.push({
path: '/setting/entitySetting', path: '/setting/entityIntegration',
query: { query: {
t: +new Date() t: +new Date()
} }
@@ -673,7 +677,7 @@ export default {
queryInfo.name = this.settingObj.name queryInfo.name = this.settingObj.name
} }
this.$router.push({ this.$router.push({
path: '/setting/entitySetting', path: '/setting/entityIntegration',
query: queryInfo query: queryInfo
}) })
} else { } else {
@@ -706,7 +710,7 @@ export default {
// } else { // } else {
// } // }
this.$router.push({ this.$router.push({
path: '/setting/entitySetting', path: '/setting/entityIntegration',
query: queryInfo query: queryInfo
}) })
}, },
@@ -721,7 +725,7 @@ export default {
customClass: 'del-model' customClass: 'del-model'
}).then(() => { }).then(() => {
this.$router.push({ this.$router.push({
path: '/setting/entitySetting', path: '/setting/entityIntegration',
query: queryInfo query: queryInfo
}) })
}).catch(() => { }).catch(() => {

View File

@@ -22,6 +22,12 @@
<i class="cn-icon-edit cn-icon"></i> <i class="cn-icon-edit cn-icon"></i>
<span>{{ $t('overall.edit') }}</span> <span>{{ $t('overall.edit') }}</span>
</button> </button>
<button id="tag-view" class="business-button business-button--light tag__btn margin-r-10 tool-btn-view"
:disabled="disableView"
@click="viewSource">
<i class="cn-icon-preview cn-icon"></i>
<span>{{ $t('overall.view') }}</span>
</button>
<button id="tag-delete" class="business-button business-button--light tag__btn margin-r-10" <button id="tag-delete" class="business-button business-button--light tag__btn margin-r-10"
:disabled="disableDelete" :disabled="disableDelete"
@click="delBatch"> @click="delBatch">
@@ -223,6 +229,17 @@ export default {
this.jumpToEditPage(this.batchDeleteObjs[0].id) this.jumpToEditPage(this.batchDeleteObjs[0].id)
} }
}, },
viewSource () {
const pageNo = this.$router.currentRoute.value.query.pageNo
this.$router.push({
path: '/setting/source/view',
query: {
t: +new Date(),
pageNoForTable: pageNo || 1,
id: this.batchDeleteObjs[0].id
}
})
},
jumpToEditPage (id) { jumpToEditPage (id) {
const pageNo = this.$router.currentRoute.value.query.pageNo const pageNo = this.$router.currentRoute.value.query.pageNo
this.$router.push({ this.$router.push({

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="sources-form"> <div class="sources-form">
<loading :loading="myLoading"></loading> <loading :loading="myLoading"></loading>
<div class="sources-form__header">{{ sourceObj.id ? $t('sources.editSource') : $t('sources.createSource') }}</div> <div class="sources-form__header">{{ pageHeaderName }}</div>
<div class="sources-form__body"> <div class="sources-form__body">
<el-form ref="baseForm" :model="sourceObj" label-position="top" style="width: 620px" :rules="rules"> <el-form ref="baseForm" :model="sourceObj" label-position="top" style="width: 620px" :rules="rules">
<el-form-item :label="$t('overall.name')" prop="name"> <el-form-item :label="$t('overall.name')" prop="name">
@@ -154,7 +154,7 @@
<span>{{ $t('overall.cancel') }}</span> <span>{{ $t('overall.cancel') }}</span>
</button> </button>
<button style="position: relative;" :class="{'disabled': blockOperation.save}" <button style="position: relative;" :class="{'disabled': blockOperation.save}"
:disabled="sourceObj.usage>0 || sourceObj.isBuiltIn>0" class="business-button tag__btn" @click="saveSource"> :disabled="disabledSave" class="business-button tag__btn" @click="saveSource">
<loading :loading="blockOperation.save"></loading> <loading :loading="blockOperation.save"></loading>
<span>{{ $t('overall.save') }}</span> <span>{{ $t('overall.save') }}</span>
</button> </button>
@@ -293,6 +293,18 @@ export default {
} }
} }
}, },
computed: {
pageHeaderName () {
let name = this.$t('sources.createSource')
if (this.sourceObj.id) {
name = this.isView ? this.$t('setting.viewSource') : this.$t('sources.editSource')
}
return name
},
disabledSave () {
return this.sourceObj.usage > 0 || this.sourceObj.isBuiltIn > 0 || this.isView
}
},
mounted () { mounted () {
if (this.sourceId) { if (this.sourceId) {
this.initDetailInfo() this.initDetailInfo()
@@ -495,7 +507,7 @@ export default {
} }
}, },
setup () { setup () {
const { query } = useRoute() const { query, name } = useRoute()
const sourceId = ref(query.id || '') const sourceId = ref(query.id || '')
const pageNoForTable = ref(query.pageNoForTable || 1) const pageNoForTable = ref(query.pageNoForTable || 1)
const myLoading = ref(!!sourceId.value) const myLoading = ref(!!sourceId.value)
@@ -517,11 +529,13 @@ export default {
// enable: 1 // enable: 1
} }
const sourceObj = ref(_.cloneDeep(blankObject)) const sourceObj = ref(_.cloneDeep(blankObject))
const isView = name === 'viewDataSource'
return { return {
sourceId, sourceId,
pageNoForTable, pageNoForTable,
myLoading, myLoading,
sourceObj sourceObj,
isView
} }
} }
} }