NEZ-2977 fix:asset attribute text等类型增加 default 参数配置及显示
This commit is contained in:
@@ -181,6 +181,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.form__dotted-item-required {
|
||||||
|
.el-form-item__label {
|
||||||
|
display: flex;
|
||||||
|
.form__labels-label {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.form__create-btn {
|
.form__create-btn {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ export const asset = {
|
|||||||
INTEGER: 'INTEGER',
|
INTEGER: 'INTEGER',
|
||||||
DOUBLE: 'DOUBLE',
|
DOUBLE: 'DOUBLE',
|
||||||
DATETIME: 'DATETIME',
|
DATETIME: 'DATETIME',
|
||||||
EMAIL: 'EMAIL'
|
EMAIL: 'EMAIL',
|
||||||
|
PASSWORD: 'PASSWORD'
|
||||||
},
|
},
|
||||||
labelSubTypeData: {
|
labelSubTypeData: {
|
||||||
date: 'date',
|
date: 'date',
|
||||||
|
|||||||
@@ -84,8 +84,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- labels -->
|
<!-- labels -->
|
||||||
<div class="form__sub-title">{{$t('overall.labels')}}</div>
|
<div class="form__sub-title">{{$t('overall.labels')}}</div>
|
||||||
<div v-for="(label, i) in editAsset.fields" :key="i" class="form__dotted-item">
|
<div v-for="(label, i) in editAsset.fields" :key="i" class="form__dotted-item form__dotted-item-required">
|
||||||
<el-form-item :prop="'fields.' + i + '.value'">
|
<el-form-item :prop="'fields.' + i + '.value.0'" :rules="[ { required: JSON.parse(label.param).required === '1', message: $t('validate.required'), trigger: 'blur' }]">
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
<div class="form__labels-label">
|
<div class="form__labels-label">
|
||||||
<span>{{label.name}}</span>
|
<span>{{label.name}}</span>
|
||||||
@@ -98,6 +98,9 @@
|
|||||||
<template v-if="label.type.toUpperCase() === assetConstants.labelTypeData.TEXT">
|
<template v-if="label.type.toUpperCase() === assetConstants.labelTypeData.TEXT">
|
||||||
<el-input v-model="label.value[0]" size="small"/>
|
<el-input v-model="label.value[0]" size="small"/>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.PASSWORD">
|
||||||
|
<el-input v-model="label.value[0]" type="password" size="small"/>
|
||||||
|
</template>
|
||||||
<template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.MULTITEXT">
|
<template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.MULTITEXT">
|
||||||
<div v-for="(value, i) in label.value" :key="i" class="label__multi-text">
|
<div v-for="(value, i) in label.value" :key="i" class="label__multi-text">
|
||||||
<el-input v-model="label.value[i]" size="small"/>
|
<el-input v-model="label.value[i]" size="small"/>
|
||||||
@@ -666,6 +669,7 @@ export default {
|
|||||||
label.value.splice(index, 1)
|
label.value.splice(index, 1)
|
||||||
},
|
},
|
||||||
blankLabelValue (label) {
|
blankLabelValue (label) {
|
||||||
|
const defaultValue = JSON.parse(label.param).default || ''
|
||||||
if (label.type.toUpperCase() === this.assetConstants.labelTypeData.CHECKBOX) {
|
if (label.type.toUpperCase() === this.assetConstants.labelTypeData.CHECKBOX) {
|
||||||
const arr = []
|
const arr = []
|
||||||
if (label.param && JSON.parse(label.param).items) {
|
if (label.param && JSON.parse(label.param).items) {
|
||||||
@@ -677,7 +681,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return arr
|
return arr
|
||||||
} else if (label.type.toUpperCase() === this.assetConstants.labelTypeData.MULTITEXT || label.type.toUpperCase() === assetConstants.labelTypeData.TEXT || label.type.toUpperCase() === assetConstants.labelTypeData.TEXTAREA) {
|
} else if (label.type.toUpperCase() === this.assetConstants.labelTypeData.MULTITEXT || label.type.toUpperCase() === assetConstants.labelTypeData.TEXT || label.type.toUpperCase() === assetConstants.labelTypeData.TEXTAREA) {
|
||||||
return ['']
|
return [defaultValue]
|
||||||
} else if (label.type.toUpperCase() === this.assetConstants.labelTypeData.RADIO || label.type.toUpperCase() === assetConstants.labelTypeData.SELECT) {
|
} else if (label.type.toUpperCase() === this.assetConstants.labelTypeData.RADIO || label.type.toUpperCase() === assetConstants.labelTypeData.SELECT) {
|
||||||
const arr = ['']
|
const arr = ['']
|
||||||
if (label.param && JSON.parse(label.param).items) {
|
if (label.param && JSON.parse(label.param).items) {
|
||||||
@@ -689,7 +693,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return arr
|
return arr
|
||||||
} else {
|
} else {
|
||||||
return ['']
|
return [defaultValue]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getParentAsset () {
|
getParentAsset () {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label='$t("validate.required")' prop="display">
|
<el-form-item :label='$t("validate.required")' prop="display">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="editAssetMeta.required"
|
v-model="editAssetMeta.param.required"
|
||||||
active-value="1"
|
active-value="1"
|
||||||
inactive-value="0">
|
inactive-value="0">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
@@ -279,15 +279,19 @@ export default {
|
|||||||
immediate: true,
|
immediate: true,
|
||||||
handler (n) {
|
handler (n) {
|
||||||
this.isEdit = true
|
this.isEdit = true
|
||||||
|
const param = n.param && ((typeof n.param) === 'string') ? JSON.parse(n.param) : {}
|
||||||
|
if (!param.required) {
|
||||||
|
param.required = '0'
|
||||||
|
}
|
||||||
this.editAssetMeta = {
|
this.editAssetMeta = {
|
||||||
...n,
|
...n,
|
||||||
groupId: n.groupId ? Number(n.groupId) : '',
|
groupId: n.groupId ? Number(n.groupId) : '',
|
||||||
search: `${n.search}`,
|
search: `${n.search}`,
|
||||||
display: `${n.display}`,
|
display: `${n.display}`,
|
||||||
required: n.required ? `${n.required}` : '0',
|
param: param,
|
||||||
param: n.param && ((typeof n.param) === 'string') ? JSON.parse(n.param) : {},
|
|
||||||
type: n.type.toUpperCase()
|
type: n.type.toUpperCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectType(this.editAssetMeta.type, true)
|
this.selectType(this.editAssetMeta.type, true)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -359,11 +363,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (param.type !== 'RADIO' && param.type !== 'CHECKBOX' && param.type !== 'SELECT' && param.type !== 'DATETIME' && param.type !== 'DOUBLE') {
|
param.param = JSON.stringify(param.param)
|
||||||
delete param.param
|
|
||||||
} else {
|
|
||||||
param.param = JSON.stringify(param.param)
|
|
||||||
}
|
|
||||||
if (this.editAssetMeta.id) {
|
if (this.editAssetMeta.id) {
|
||||||
this.$put('asset/field/meta', param).then(response => {
|
this.$put('asset/field/meta', param).then(response => {
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
@@ -432,7 +432,7 @@ export default {
|
|||||||
case 'TEXT' :
|
case 'TEXT' :
|
||||||
case 'TEXTAREA' :
|
case 'TEXTAREA' :
|
||||||
case 'INTEGER' :
|
case 'INTEGER' :
|
||||||
case 'PASSWORD' :
|
// case 'PASSWORD' :
|
||||||
this.showParam = true
|
this.showParam = true
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
@@ -441,13 +441,15 @@ export default {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.ready) {
|
if (this.ready) {
|
||||||
|
const required = this.editAssetMeta.param.required
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 'RADIO' :
|
case 'RADIO' :
|
||||||
case 'CHECKBOX' :
|
case 'CHECKBOX' :
|
||||||
case 'SELECT' :
|
case 'SELECT' :
|
||||||
this.showParam = true
|
this.showParam = true
|
||||||
this.editAssetMeta.param = {
|
this.editAssetMeta.param = {
|
||||||
items: []
|
items: [],
|
||||||
|
required: required
|
||||||
}
|
}
|
||||||
this.editAssetMeta.param.items = [{
|
this.editAssetMeta.param.items = [{
|
||||||
name: 'Option 1',
|
name: 'Option 1',
|
||||||
@@ -460,6 +462,7 @@ export default {
|
|||||||
case 'DATETIME' :
|
case 'DATETIME' :
|
||||||
this.showParam = true
|
this.showParam = true
|
||||||
this.editAssetMeta.param = {
|
this.editAssetMeta.param = {
|
||||||
|
required: required,
|
||||||
subType: 'date',
|
subType: 'date',
|
||||||
interval: false
|
interval: false
|
||||||
}
|
}
|
||||||
@@ -468,31 +471,41 @@ export default {
|
|||||||
this.showParam = true
|
this.showParam = true
|
||||||
this.editAssetMeta.param = {
|
this.editAssetMeta.param = {
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
default: undefined
|
default: undefined,
|
||||||
|
required: required
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'TEXT' :
|
case 'TEXT' :
|
||||||
this.showParam = true
|
this.showParam = true
|
||||||
this.editAssetMeta.param = {
|
this.editAssetMeta.param = {
|
||||||
default: ''
|
default: '',
|
||||||
|
required: required
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'TEXTAREA' :
|
case 'TEXTAREA' :
|
||||||
this.showParam = true
|
this.showParam = true
|
||||||
this.editAssetMeta.param = {
|
this.editAssetMeta.param = {
|
||||||
default: ''
|
default: '',
|
||||||
|
required: required
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'INTEGER' :
|
case 'INTEGER' :
|
||||||
this.showParam = true
|
this.showParam = true
|
||||||
this.editAssetMeta.param = {
|
this.editAssetMeta.param = {
|
||||||
default: undefined
|
default: undefined,
|
||||||
|
required: required
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'PASSWORD' :
|
case 'PASSWORD' :
|
||||||
this.showParam = true
|
this.showParam = false
|
||||||
this.editAssetMeta.param = {
|
this.editAssetMeta.param = {
|
||||||
default: ''
|
required: required
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'EMAIL' :
|
||||||
|
this.showParam = false
|
||||||
|
this.editAssetMeta.param = {
|
||||||
|
required: required
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
<div v-else-if="scope.row[item.prop].toUpperCase() == 'DOUBLE'"><i class="nz-icon nz-icon-double"></i> DOUBLE</div>
|
<div v-else-if="scope.row[item.prop].toUpperCase() == 'DOUBLE'"><i class="nz-icon nz-icon-double"></i> DOUBLE</div>
|
||||||
<div v-else-if="scope.row[item.prop].toUpperCase() == 'DATETIME'"><i class="nz-icon nz-icon-dingshishijian"></i> DATETIME</div>
|
<div v-else-if="scope.row[item.prop].toUpperCase() == 'DATETIME'"><i class="nz-icon nz-icon-dingshishijian"></i> DATETIME</div>
|
||||||
<div v-else-if="scope.row[item.prop].toUpperCase() == 'EMAIL'"><i class="nz-icon nz-icon-email"></i> EMAIL</div>
|
<div v-else-if="scope.row[item.prop].toUpperCase() == 'EMAIL'"><i class="nz-icon nz-icon-email"></i> EMAIL</div>
|
||||||
|
<div v-else-if="scope.row[item.prop].toUpperCase() == 'PASSWORD'"><i class="nz-icon nz-icon-password"></i> PASSWORD</div>
|
||||||
</div>
|
</div>
|
||||||
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop] || '-'}}</span>
|
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop] || '-'}}</span>
|
||||||
<template v-else>-</template>
|
<template v-else>-</template>
|
||||||
|
|||||||
@@ -160,9 +160,8 @@ export default {
|
|||||||
group: {},
|
group: {},
|
||||||
search: '0',
|
search: '0',
|
||||||
display: '0',
|
display: '0',
|
||||||
required: '0',
|
|
||||||
type: 'TEXT',
|
type: 'TEXT',
|
||||||
param: {},
|
param: JSON.stringify({ required: '0' }),
|
||||||
remark: ''
|
remark: ''
|
||||||
},
|
},
|
||||||
blankMetaGroup: {
|
blankMetaGroup: {
|
||||||
|
|||||||
Reference in New Issue
Block a user