Skip to content

Commit

Permalink
fix:is_list edit bug (#312)
Browse files Browse the repository at this point in the history
* feat(ui):auth setting

* fix:is_list edit bug
  • Loading branch information
wang-liang0615 authored Dec 15, 2023
1 parent c89ebf6 commit faeb9a0
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 24 deletions.
14 changes: 13 additions & 1 deletion cmdb-ui/src/modules/cmdb/views/ci/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<span>{{ col.title }}</span>
</span>
</template>
<template v-if="col.is_choice || col.is_password" #edit="{ row }">
<template v-if="col.is_choice || col.is_password || col.is_list" #edit="{ row }">
<vxe-input v-if="col.is_password" v-model="passwordValue[col.field]" />
<a-select
:getPopupContainer="(trigger) => trigger.parentElement"
Expand Down Expand Up @@ -145,6 +145,18 @@
</span>
</a-select-option>
</a-select>
<a-select
:getPopupContainer="(trigger) => trigger.parentElement"
:style="{ width: '100%', height: '32px' }"
v-model="row[col.field]"
placeholder="请选择"
v-else-if="col.is_list"
:showArrow="false"
mode="tags"
class="ci-table-edit-select"
allowClear
>
</a-select>
</template>
<template
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
Expand Down
23 changes: 21 additions & 2 deletions cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailAttrContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
{{ ci[attr.name] }}
</span>
</template>
<template v-else-if="attr.is_list">
<span> {{ ci[attr.name].join(',') }}</span>
</template>
<template v-else>{{ getName(ci[attr.name]) }}</template>
</span>
<template v-else>
Expand All @@ -75,7 +78,6 @@
placeholder="请选择"
v-if="attr.is_choice"
:mode="attr.is_list ? 'multiple' : 'default'"
:multiple="attr.is_list"
showSearch
allowClear
size="small"
Expand Down Expand Up @@ -103,6 +105,23 @@
</span>
</a-select-option>
</a-select>
<a-select
:style="{ width: '100%' }"
v-decorator="[
attr.name,
{
rules: [{ required: attr.is_required }],
},
]"
placeholder="请选择"
v-else-if="attr.is_list"
mode="tags"
showSearch
allowClear
size="small"
:getPopupContainer="(trigger) => trigger.parentElement"
>
</a-select>
<a-input-number
size="small"
v-decorator="[
Expand Down Expand Up @@ -222,7 +241,7 @@ export default {
this.$nextTick(async () => {
if (this.attr.is_list && !this.attr.is_choice) {
this.form.setFieldsValue({
[`${this.attr.name}`]: this.ci[this.attr.name].join(',') || null,
[`${this.attr.name}`]: this.ci[this.attr.name]|| null,
})
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
placeholder="请选择"
v-if="attr.is_choice"
:mode="attr.is_list ? 'multiple' : 'default'"
:multiple="attr.is_list"
showSearch
allowClear
>
Expand Down
28 changes: 18 additions & 10 deletions cmdb-ui/src/modules/cmdb/views/relation_views/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
:expandedKeys="expandedKeys"
>
<a-icon slot="switcherIcon" type="down" />
<template #title="{ key: treeKey, title,isLeaf }">
<template #title="{ key: treeKey, title, isLeaf }">
<ContextMenu
:title="title"
:treeKey="treeKey"
Expand Down Expand Up @@ -58,12 +58,8 @@
/>
<div class="relation-views-right-bar">
<a-space>
<a-button
v-if="isLeaf"
type="primary"
size="small"
@click="$refs.create.handleOpen(true, 'create')"
>新建</a-button
<a-button v-if="isLeaf" type="primary" size="small" @click="$refs.create.handleOpen(true, 'create')"
>新建</a-button
>

<div class="ops-list-batch-action" v-if="isLeaf && isShowBatchIcon">
Expand Down Expand Up @@ -135,7 +131,7 @@
{{ col.title }}</span
>
</template>
<template v-if="col.is_choice || col.is_password" #edit="{ row }">
<template v-if="col.is_choice || col.is_password || col.is_list" #edit="{ row }">
<vxe-input v-if="col.is_password" v-model="passwordValue[col.field]" />
<a-select
:getPopupContainer="(trigger) => trigger.parentElement"
Expand Down Expand Up @@ -172,6 +168,18 @@
</span>
</a-select-option>
</a-select>
<a-select
:getPopupContainer="(trigger) => trigger.parentElement"
:style="{ width: '100%', height: '32px' }"
v-model="row[col.field]"
placeholder="请选择"
v-else-if="col.is_list"
:showArrow="false"
mode="tags"
class="ci-table-edit-select"
allowClear
>
</a-select>
</template>
<template
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
Expand Down Expand Up @@ -483,11 +491,11 @@ export default {
},
inject: ['reload'],
watch: {
'$route.path': function(newPath, oldPath) {
'$route.path': function (newPath, oldPath) {
this.viewId = this.$route.params.viewId
this.reload()
},
pageNo: function(newPage, oldPage) {
pageNo: function (newPage, oldPage) {
this.loadData({ pageNo: newPage }, undefined, this.sortByTable)
},
},
Expand Down
31 changes: 21 additions & 10 deletions cmdb-ui/src/modules/cmdb/views/tree_views/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@
}
"
class="cmdb-views-header-metadata"
><a-icon type="info-circle" />
><a-icon type="info-circle" />
属性说明
</span>
</span>
<a-button
size="small"
icon="plus"
type="primary"
@click="$refs.create.handleOpen(true, 'create')"
>新建</a-button
<a-button size="small" icon="plus" type="primary" @click="$refs.create.handleOpen(true, 'create')"
>新建</a-button
>
</div>
<SplitPane
Expand Down Expand Up @@ -193,7 +189,7 @@
{{ col.title }}</span
>
</template>
<template v-if="col.is_choice || col.is_password" #edit="{ row }">
<template v-if="col.is_choice || col.is_password || col.is_list" #edit="{ row }">
<vxe-input v-if="col.is_password" v-model="passwordValue[col.field]" />
<a-select
:getPopupContainer="(trigger) => trigger.parentElement"
Expand Down Expand Up @@ -230,6 +226,18 @@
</span>
</a-select-option>
</a-select>
<a-select
:getPopupContainer="(trigger) => trigger.parentElement"
:style="{ width: '100%', height: '32px' }"
v-model="row[col.field]"
placeholder="请选择"
v-else-if="col.is_list"
:showArrow="false"
mode="tags"
class="ci-table-edit-select"
allowClear
>
</a-select>
</template>
<template
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
Expand Down Expand Up @@ -504,7 +512,7 @@ export default {
},
},
watch: {
'$route.path': function(newPath, oldPath) {
'$route.path': function (newPath, oldPath) {
this.newLoad = true
this.typeId = this.$route.params.typeId
this.initPage()
Expand Down Expand Up @@ -972,7 +980,10 @@ export default {
const $table = this.$refs['xTable'].getVxetableRef()
const data = {}
this.columns.forEach((item) => {
if (!(item.field in this.initialPasswordValue) && !_.isEqual(row[item.field], this.initialInstanceList[rowIndex][item.field])) {
if (
!(item.field in this.initialPasswordValue) &&
!_.isEqual(row[item.field], this.initialInstanceList[rowIndex][item.field])
) {
data[item.field] = row[item.field] ?? null
}
})
Expand Down

0 comments on commit faeb9a0

Please sign in to comment.