mirror of https://github.com/veops/cmdb.git
模型属性 is_index
This commit is contained in:
parent
b0c21fe735
commit
e31fee9f6d
|
@ -33,13 +33,11 @@
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col
|
<a-col :span="12"
|
||||||
:span="12"
|
|
||||||
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="别名">
|
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="别名">
|
||||||
<a-input name="alias" v-decorator="['alias', { rules: [] }]" /> </a-form-item
|
<a-input name="alias" v-decorator="['alias', { rules: [] }]" /> </a-form-item
|
||||||
></a-col>
|
></a-col>
|
||||||
<a-col
|
<a-col :span="12"
|
||||||
:span="12"
|
|
||||||
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="数据类型">
|
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="数据类型">
|
||||||
<a-select
|
<a-select
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
|
@ -156,11 +154,14 @@
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6" v-if="currentValueType !== '6'">
|
<a-col :span="currentValueType === '2' ? 6 : 0" v-if="currentValueType !== '6'">
|
||||||
<a-form-item :label-col="horizontalFormItemLayout.labelCol" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
<a-form-item
|
||||||
|
:hidden="currentValueType === '2' ? false : true"
|
||||||
|
:label-col="horizontalFormItemLayout.labelCol"
|
||||||
|
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||||
|
>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span
|
<span style="position: relative; white-space: pre"
|
||||||
style="position: relative; white-space: pre"
|
|
||||||
>{{ `索引` }}
|
>{{ `索引` }}
|
||||||
<a-tooltip title="字段可被用于检索,加速查询">
|
<a-tooltip title="字段可被用于检索,加速查询">
|
||||||
<a-icon
|
<a-icon
|
||||||
|
@ -186,10 +187,12 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
<a-form-item
|
||||||
|
:label-col="currentValueType === '2' ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||||
|
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||||
|
>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span
|
<span style="position: relative; white-space: pre"
|
||||||
style="position: relative; white-space: pre"
|
|
||||||
>{{ `显示` }}
|
>{{ `显示` }}
|
||||||
<a-tooltip title="CI实例表格默认展示该字段">
|
<a-tooltip title="CI实例表格默认展示该字段">
|
||||||
<a-icon
|
<a-icon
|
||||||
|
@ -215,7 +218,7 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6" v-if="currentValueType !== '6'">
|
<a-col :span="6" v-if="currentValueType !== '6'">
|
||||||
<a-form-item
|
<a-form-item
|
||||||
:label-col="horizontalFormItemLayout.labelCol"
|
:label-col="currentValueType === '2' ? horizontalFormItemLayout.labelCol : { span: 8 }"
|
||||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||||
label="排序"
|
label="排序"
|
||||||
>
|
>
|
||||||
|
@ -229,10 +232,12 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="6" v-if="currentValueType !== '6'">
|
<a-col :span="6" v-if="currentValueType !== '6'">
|
||||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
<a-form-item
|
||||||
|
:label-col="currentValueType === '2' ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||||
|
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||||
|
>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span
|
<span style="position: relative; white-space: pre"
|
||||||
style="position: relative; white-space: pre"
|
|
||||||
>{{ `多值` }}
|
>{{ `多值` }}
|
||||||
<a-tooltip title="字段的值是1个或者多个,接口返回的值的类型是list">
|
<a-tooltip title="字段的值是1个或者多个,接口返回的值的类型是list">
|
||||||
<a-icon
|
<a-icon
|
||||||
|
@ -297,8 +302,7 @@
|
||||||
<a-col :span="24" v-if="currentValueType !== '6'">
|
<a-col :span="24" v-if="currentValueType !== '6'">
|
||||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
|
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span
|
<span style="position: relative; white-space: pre"
|
||||||
style="position: relative; white-space: pre"
|
|
||||||
>{{ `计算属性` }}
|
>{{ `计算属性` }}
|
||||||
<a-tooltip
|
<a-tooltip
|
||||||
:title="`该属性的值是通过模型的其它属性构建的表达式或者执行一段代码的方式计算而来,属性的引用方法为: {{ 属性名 }}`"
|
:title="`该属性的值是通过模型的其它属性构建的表达式或者执行一段代码的方式计算而来,属性的引用方法为: {{ 属性名 }}`"
|
||||||
|
@ -342,11 +346,7 @@
|
||||||
<script>
|
<script>
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import vueJsonEditor from 'vue-json-editor'
|
import vueJsonEditor from 'vue-json-editor'
|
||||||
import {
|
import { updateAttributeById, updateCITypeAttributesById, canDefineComputed } from '@/modules/cmdb/api/CITypeAttr'
|
||||||
updateAttributeById,
|
|
||||||
updateCITypeAttributesById,
|
|
||||||
canDefineComputed,
|
|
||||||
} from '@/modules/cmdb/api/CITypeAttr'
|
|
||||||
import { valueTypeMap } from '../../utils/const'
|
import { valueTypeMap } from '../../utils/const'
|
||||||
import ComputedArea from './computedArea.vue'
|
import ComputedArea from './computedArea.vue'
|
||||||
import PreValueArea from './preValueArea.vue'
|
import PreValueArea from './preValueArea.vue'
|
||||||
|
@ -432,13 +432,13 @@ export default {
|
||||||
this.form.setFieldsValue({
|
this.form.setFieldsValue({
|
||||||
is_list: false,
|
is_list: false,
|
||||||
is_unique: false,
|
is_unique: false,
|
||||||
is_index: false,
|
|
||||||
is_sortable: false,
|
is_sortable: false,
|
||||||
})
|
})
|
||||||
if (this.currentValueType === '2') {
|
if (this.currentValueType === '2') {
|
||||||
this.form.setFieldsValue({
|
this.form.setFieldsValue({
|
||||||
is_password: false,
|
is_password: false,
|
||||||
is_link: false,
|
is_link: false,
|
||||||
|
is_index: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6" v-if="currentValueType !== '6'">
|
<a-col :span="6" v-if="currentValueType === '2'">
|
||||||
<a-form-item :label-col="horizontalFormItemLayout.labelCol" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
<a-form-item :label-col="horizontalFormItemLayout.labelCol" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span
|
<span
|
||||||
|
@ -174,12 +174,15 @@
|
||||||
:disabled="isShowComputedArea"
|
:disabled="isShowComputedArea"
|
||||||
@change="onChange"
|
@change="onChange"
|
||||||
name="is_index"
|
name="is_index"
|
||||||
v-decorator="['is_index', { rules: [], valuePropName: 'checked' }]"
|
v-decorator="['is_index', { rules: [], valuePropName: 'checked', initialValue: true }]"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
<a-form-item
|
||||||
|
:label-col="currentValueType === '2' ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||||
|
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||||
|
>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span
|
<span
|
||||||
style="position:relative;white-space:pre;"
|
style="position:relative;white-space:pre;"
|
||||||
|
@ -208,7 +211,7 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6" v-if="currentValueType !== '6'">
|
<a-col :span="6" v-if="currentValueType !== '6'">
|
||||||
<a-form-item
|
<a-form-item
|
||||||
:label-col="horizontalFormItemLayout.labelCol"
|
:label-col="currentValueType === '2' ? horizontalFormItemLayout.labelCol : { span: 8 }"
|
||||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||||
label="排序"
|
label="排序"
|
||||||
>
|
>
|
||||||
|
@ -222,7 +225,10 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="6" v-if="currentValueType !== '6'">
|
<a-col :span="6" v-if="currentValueType !== '6'">
|
||||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol">
|
<a-form-item
|
||||||
|
:label-col="currentValueType === '2' ? { span: 8 } : horizontalFormItemLayout.labelCol"
|
||||||
|
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||||
|
>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<span
|
<span
|
||||||
style="position:relative;white-space:pre;"
|
style="position:relative;white-space:pre;"
|
||||||
|
@ -420,6 +426,14 @@ export default {
|
||||||
}
|
}
|
||||||
const fontOptions = this.$refs.fontArea.getData()
|
const fontOptions = this.$refs.fontArea.getData()
|
||||||
|
|
||||||
|
// is_index进行操作,除了文本 索引隐藏掉 文本 索引默认是true
|
||||||
|
// 框里的5种类型 is_index=true
|
||||||
|
// json类型 is_index=false
|
||||||
|
if (values.value_type === '6') {
|
||||||
|
values.is_index = false
|
||||||
|
} else if (values.value_type !== '2') {
|
||||||
|
values.is_index = true
|
||||||
|
}
|
||||||
const { attr_id } = await createAttribute({ ...values, option: { fontOptions } })
|
const { attr_id } = await createAttribute({ ...values, option: { fontOptions } })
|
||||||
|
|
||||||
this.form.resetFields()
|
this.form.resetFields()
|
||||||
|
|
Loading…
Reference in New Issue