mirror of https://github.com/veops/cmdb.git
feat(ui): update
This commit is contained in:
parent
ba1064495b
commit
5cbcbaf93d
|
@ -57,7 +57,9 @@ export default {
|
|||
computed: {
|
||||
...mapState(['user', 'locale']),
|
||||
hasBackendPermission() {
|
||||
return this.user?.detailPermissions?.backend?.length
|
||||
const isAdmin = this?.user?.roles?.permissions?.includes('acl_admin')
|
||||
|
||||
return isAdmin || this.user?.detailPermissions?.backend?.length
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -147,9 +147,9 @@
|
|||
<a-form-model-item :required="true" :label="$t('cmdb.ciType.password')">
|
||||
<a-input-password v-model="privateCloudForm.password" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item :label="$t('cmdb.ciType.insecure')">
|
||||
<!-- <a-form-model-item :label="$t('cmdb.ciType.insecure')">
|
||||
<a-switch v-model="privateCloudForm.insecure" />
|
||||
</a-form-model-item>
|
||||
</a-form-model-item> -->
|
||||
<a-form-model-item :label="$t('cmdb.ciType.vcenterName')">
|
||||
<a-input v-model="privateCloudForm.vcenterName" />
|
||||
</a-form-model-item>
|
||||
|
@ -189,6 +189,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { mapState } from 'vuex'
|
||||
import Vcrontab from '@/components/Crontab'
|
||||
|
@ -260,7 +261,7 @@ export default {
|
|||
host: '',
|
||||
account: '',
|
||||
password: '',
|
||||
insecure: false,
|
||||
// insecure: false,
|
||||
vcenterName: '',
|
||||
},
|
||||
interval: 'cron', // interval cron
|
||||
|
@ -344,7 +345,7 @@ export default {
|
|||
host = '',
|
||||
account = '',
|
||||
password = '',
|
||||
insecure = false,
|
||||
// insecure = false,
|
||||
vcenterName = ''
|
||||
} = _findADT?.extra_option ?? {}
|
||||
|
||||
|
@ -357,7 +358,7 @@ export default {
|
|||
host,
|
||||
account,
|
||||
password,
|
||||
insecure,
|
||||
// insecure,
|
||||
vcenterName,
|
||||
}
|
||||
}
|
||||
|
@ -524,6 +525,10 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
if (params.extra_option) {
|
||||
params.extra_option = _.omit(params.extra_option, 'insecure')
|
||||
}
|
||||
|
||||
if (currentAdt?.isClient) {
|
||||
postCITypeDiscovery(this.CITypeId, params).then((res) => {
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
|
|
|
@ -85,10 +85,10 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
transferDataSource() {
|
||||
const dataSource = this.CITypeGroups.reduce((acc, item) => {
|
||||
const types = _.cloneDeep(item?.ci_types || [])
|
||||
const dataSource = this.CITypeGroups.reduce((acc, group) => {
|
||||
const types = _.cloneDeep(group?.ci_types || [])
|
||||
types.forEach((item) => {
|
||||
item.key = String(item.id)
|
||||
item.key = `${group.id}-${item.id}`
|
||||
item.title = item?.alias || item?.name || this.$t('other')
|
||||
})
|
||||
return acc.concat(types)
|
||||
|
@ -100,7 +100,7 @@ export default {
|
|||
let newTreeData = treeData.map((item) => {
|
||||
const childrenKeys = []
|
||||
const children = (item.ci_types || []).map((child) => {
|
||||
const key = String(child?.id)
|
||||
const key = `${item.id}-${child.id}`
|
||||
const disabled = this.targetKeys.includes(key)
|
||||
childrenKeys.push(key)
|
||||
|
||||
|
@ -119,9 +119,7 @@ export default {
|
|||
disabled: children.every((item) => item.disabled),
|
||||
}
|
||||
})
|
||||
console.log('treeData', newTreeData)
|
||||
newTreeData = newTreeData.filter((item) => item.children.length > 0)
|
||||
|
||||
return newTreeData
|
||||
}
|
||||
},
|
||||
|
@ -148,7 +146,6 @@ export default {
|
|||
const { eventKey } = e.node
|
||||
const selected = checkedKeys.indexOf(eventKey) === -1
|
||||
const childrenKeys = this.treeData.find((item) => item.key === eventKey)?.childrenKeys || []
|
||||
|
||||
// 如果当前点击是子节点,处理其联动父节点
|
||||
this.treeData.forEach((item) => {
|
||||
if (item.childrenKeys.includes(eventKey)) {
|
||||
|
@ -159,7 +156,6 @@ export default {
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
itemSelectAll([eventKey, ...childrenKeys], selected)
|
||||
},
|
||||
handleCancel() {
|
||||
|
@ -176,7 +172,7 @@ export default {
|
|||
const hide = this.$message.loading(this.$t('loading'), 0)
|
||||
|
||||
try {
|
||||
const typeIds = this.targetKeys.join(',')
|
||||
const typeIds = this.getTypeIds(this.targetKeys)
|
||||
const res = await exportCITypeGroups({
|
||||
type_ids: typeIds
|
||||
})
|
||||
|
@ -204,6 +200,13 @@ export default {
|
|||
hide()
|
||||
this.btnLoading = false
|
||||
})
|
||||
},
|
||||
getTypeIds(targetKeys) {
|
||||
let typeIds = targetKeys?.map((key) => {
|
||||
return this?.transferDataSource?.find((node) => node?.key === key)?.id || ''
|
||||
})
|
||||
typeIds = typeIds.filter((id) => id)
|
||||
return typeIds?.join(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,16 +103,20 @@
|
|||
>
|
||||
<template v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice" #default="{row}">
|
||||
<span v-if="col.value_type === '6' && row[col.field]">{{ JSON.stringify(row[col.field]) }}</span>
|
||||
<a
|
||||
v-else-if="col.is_link && row[col.field]"
|
||||
:href="
|
||||
row[col.field].startsWith('http') || row[col.field].startsWith('https')
|
||||
? `${row[col.field]}`
|
||||
: `http://${row[col.field]}`
|
||||
"
|
||||
target="_blank"
|
||||
>{{ row[col.field] }}</a
|
||||
>
|
||||
<template v-else-if="col.is_link && row[col.field]">
|
||||
<a
|
||||
v-for="(item, linkIndex) in (col.is_list ? row[col.field] : [row[col.field]])"
|
||||
:key="linkIndex"
|
||||
:href="
|
||||
item.startsWith('http') || item.startsWith('https')
|
||||
? `${item}`
|
||||
: `http://${item}`
|
||||
"
|
||||
target="_blank"
|
||||
>
|
||||
{{ item }}
|
||||
</a>
|
||||
</template>
|
||||
<PasswordField
|
||||
v-else-if="col.is_password && row[col.field]"
|
||||
:ci_id="row._id"
|
||||
|
|
|
@ -242,16 +242,20 @@
|
|||
#default="{row}"
|
||||
>
|
||||
<span v-if="col.value_type === '6' && row[col.field]">{{ row[col.field] }}</span>
|
||||
<a
|
||||
v-else-if="col.is_link && row[col.field]"
|
||||
:href="
|
||||
row[col.field].startsWith('http') || row[col.field].startsWith('https')
|
||||
? `${row[col.field]}`
|
||||
: `http://${row[col.field]}`
|
||||
"
|
||||
target="_blank"
|
||||
>{{ row[col.field] }}</a
|
||||
>
|
||||
<template v-else-if="col.is_link && row[col.field]">
|
||||
<a
|
||||
v-for="(item, linkIndex) in (col.is_list ? row[col.field] : [row[col.field]])"
|
||||
:key="linkIndex"
|
||||
:href="
|
||||
item.startsWith('http') || item.startsWith('https')
|
||||
? `${item}`
|
||||
: `http://${item}`
|
||||
"
|
||||
target="_blank"
|
||||
>
|
||||
{{ item }}
|
||||
</a>
|
||||
</template>
|
||||
<PasswordField
|
||||
v-else-if="col.is_password && row[col.field]"
|
||||
:ci_id="row._id"
|
||||
|
|
Loading…
Reference in New Issue