mirror of https://github.com/veops/cmdb.git
fix:is_list edit bug (#312)
* feat(ui):auth setting * fix:is_list edit bug
This commit is contained in:
parent
c89ebf6518
commit
faeb9a04f9
|
@ -108,7 +108,7 @@
|
||||||
<span>{{ col.title }}</span>
|
<span>{{ col.title }}</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</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]" />
|
<vxe-input v-if="col.is_password" v-model="passwordValue[col.field]" />
|
||||||
<a-select
|
<a-select
|
||||||
:getPopupContainer="(trigger) => trigger.parentElement"
|
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||||
|
@ -145,6 +145,18 @@
|
||||||
</span>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</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>
|
||||||
<template
|
<template
|
||||||
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
|
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
|
||||||
|
|
|
@ -59,6 +59,9 @@
|
||||||
{{ ci[attr.name] }}
|
{{ ci[attr.name] }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="attr.is_list">
|
||||||
|
<span> {{ ci[attr.name].join(',') }}</span>
|
||||||
|
</template>
|
||||||
<template v-else>{{ getName(ci[attr.name]) }}</template>
|
<template v-else>{{ getName(ci[attr.name]) }}</template>
|
||||||
</span>
|
</span>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
@ -75,7 +78,6 @@
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
v-if="attr.is_choice"
|
v-if="attr.is_choice"
|
||||||
:mode="attr.is_list ? 'multiple' : 'default'"
|
:mode="attr.is_list ? 'multiple' : 'default'"
|
||||||
:multiple="attr.is_list"
|
|
||||||
showSearch
|
showSearch
|
||||||
allowClear
|
allowClear
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -103,6 +105,23 @@
|
||||||
</span>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</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
|
<a-input-number
|
||||||
size="small"
|
size="small"
|
||||||
v-decorator="[
|
v-decorator="[
|
||||||
|
@ -222,7 +241,7 @@ export default {
|
||||||
this.$nextTick(async () => {
|
this.$nextTick(async () => {
|
||||||
if (this.attr.is_list && !this.attr.is_choice) {
|
if (this.attr.is_list && !this.attr.is_choice) {
|
||||||
this.form.setFieldsValue({
|
this.form.setFieldsValue({
|
||||||
[`${this.attr.name}`]: this.ci[this.attr.name].join(',') || null,
|
[`${this.attr.name}`]: this.ci[this.attr.name]|| null,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
v-if="attr.is_choice"
|
v-if="attr.is_choice"
|
||||||
:mode="attr.is_list ? 'multiple' : 'default'"
|
:mode="attr.is_list ? 'multiple' : 'default'"
|
||||||
:multiple="attr.is_list"
|
|
||||||
showSearch
|
showSearch
|
||||||
allowClear
|
allowClear
|
||||||
>
|
>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
:expandedKeys="expandedKeys"
|
:expandedKeys="expandedKeys"
|
||||||
>
|
>
|
||||||
<a-icon slot="switcherIcon" type="down" />
|
<a-icon slot="switcherIcon" type="down" />
|
||||||
<template #title="{ key: treeKey, title,isLeaf }">
|
<template #title="{ key: treeKey, title, isLeaf }">
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
:title="title"
|
:title="title"
|
||||||
:treeKey="treeKey"
|
:treeKey="treeKey"
|
||||||
|
@ -58,12 +58,8 @@
|
||||||
/>
|
/>
|
||||||
<div class="relation-views-right-bar">
|
<div class="relation-views-right-bar">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button
|
<a-button v-if="isLeaf" type="primary" size="small" @click="$refs.create.handleOpen(true, 'create')"
|
||||||
v-if="isLeaf"
|
>新建</a-button
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
@click="$refs.create.handleOpen(true, 'create')"
|
|
||||||
>新建</a-button
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="ops-list-batch-action" v-if="isLeaf && isShowBatchIcon">
|
<div class="ops-list-batch-action" v-if="isLeaf && isShowBatchIcon">
|
||||||
|
@ -135,7 +131,7 @@
|
||||||
{{ col.title }}</span
|
{{ col.title }}</span
|
||||||
>
|
>
|
||||||
</template>
|
</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]" />
|
<vxe-input v-if="col.is_password" v-model="passwordValue[col.field]" />
|
||||||
<a-select
|
<a-select
|
||||||
:getPopupContainer="(trigger) => trigger.parentElement"
|
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||||
|
@ -172,6 +168,18 @@
|
||||||
</span>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</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>
|
||||||
<template
|
<template
|
||||||
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
|
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
|
||||||
|
@ -483,11 +491,11 @@ export default {
|
||||||
},
|
},
|
||||||
inject: ['reload'],
|
inject: ['reload'],
|
||||||
watch: {
|
watch: {
|
||||||
'$route.path': function(newPath, oldPath) {
|
'$route.path': function (newPath, oldPath) {
|
||||||
this.viewId = this.$route.params.viewId
|
this.viewId = this.$route.params.viewId
|
||||||
this.reload()
|
this.reload()
|
||||||
},
|
},
|
||||||
pageNo: function(newPage, oldPage) {
|
pageNo: function (newPage, oldPage) {
|
||||||
this.loadData({ pageNo: newPage }, undefined, this.sortByTable)
|
this.loadData({ pageNo: newPage }, undefined, this.sortByTable)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,16 +14,12 @@
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
class="cmdb-views-header-metadata"
|
class="cmdb-views-header-metadata"
|
||||||
><a-icon type="info-circle" />
|
><a-icon type="info-circle" />
|
||||||
属性说明
|
属性说明
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<a-button
|
<a-button size="small" icon="plus" type="primary" @click="$refs.create.handleOpen(true, 'create')"
|
||||||
size="small"
|
>新建</a-button
|
||||||
icon="plus"
|
|
||||||
type="primary"
|
|
||||||
@click="$refs.create.handleOpen(true, 'create')"
|
|
||||||
>新建</a-button
|
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<SplitPane
|
<SplitPane
|
||||||
|
@ -193,7 +189,7 @@
|
||||||
{{ col.title }}</span
|
{{ col.title }}</span
|
||||||
>
|
>
|
||||||
</template>
|
</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]" />
|
<vxe-input v-if="col.is_password" v-model="passwordValue[col.field]" />
|
||||||
<a-select
|
<a-select
|
||||||
:getPopupContainer="(trigger) => trigger.parentElement"
|
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||||
|
@ -230,6 +226,18 @@
|
||||||
</span>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</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>
|
||||||
<template
|
<template
|
||||||
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
|
v-if="col.value_type === '6' || col.is_link || col.is_password || col.is_choice"
|
||||||
|
@ -504,7 +512,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route.path': function(newPath, oldPath) {
|
'$route.path': function (newPath, oldPath) {
|
||||||
this.newLoad = true
|
this.newLoad = true
|
||||||
this.typeId = this.$route.params.typeId
|
this.typeId = this.$route.params.typeId
|
||||||
this.initPage()
|
this.initPage()
|
||||||
|
@ -972,7 +980,10 @@ export default {
|
||||||
const $table = this.$refs['xTable'].getVxetableRef()
|
const $table = this.$refs['xTable'].getVxetableRef()
|
||||||
const data = {}
|
const data = {}
|
||||||
this.columns.forEach((item) => {
|
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
|
data[item.field] = row[item.field] ?? null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue