fix: 修改 创建 asset Double 精度未控制,时间不选择区间,以及checkBox value值的顺序不对的问题

This commit is contained in:
zhangyu
2021-08-26 17:10:32 +08:00
parent 63a18d7576
commit 83e57eec1f
2 changed files with 21 additions and 6 deletions

View File

@@ -115,11 +115,11 @@
<el-input v-model="label.value[0]" oninput="value=value.replace(/[^\d]/g,'')" size="small"></el-input> <el-input v-model="label.value[0]" oninput="value=value.replace(/[^\d]/g,'')" size="small"></el-input>
</template> </template>
<template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.DOUBLE"> <template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.DOUBLE">
<el-input v-model="label.value[0]" oninput="value=value.replace(/[^0-9.]/g,'')" size="small"></el-input> <el-input-number v-model="label.value[0]" :controls="false" size="small" :precision="JSON.parse(label.param).decimals" style="width: 100%;text-align: left" :max="10000000000000000000" :min="-10000000000000000000"></el-input-number>
</template> </template>
<template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.DATETIME"> <template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.DATETIME">
<template v-if="JSON.parse(label.param).subType === assetConstants.labelSubTypeData.time"> <template v-if="JSON.parse(label.param).subType === assetConstants.labelSubTypeData.time">
<div v-if="label.interval" style="display: flex; justify-content: space-between"> <div v-if="JSON.parse(label.param).interval" style="display: flex; justify-content: space-between">
<el-time-select v-model="label.value[0]" size="small"></el-time-select> <el-time-select v-model="label.value[0]" size="small"></el-time-select>
<el-time-select v-model="label.value[1]" size="small"></el-time-select> <el-time-select v-model="label.value[1]" size="small"></el-time-select>
</div> </div>
@@ -128,7 +128,7 @@
</template> </template>
</template> </template>
<template v-else> <template v-else>
<template v-if="label.interval"> <template v-if="JSON.parse(label.param).interval">
<my-date-picker <my-date-picker
id="asset-box-input-purchase-date" id="asset-box-input-purchase-date"
v-model="label.value[0]" v-model="label.value[0]"
@@ -152,7 +152,7 @@
</template> </template>
</template> </template>
<template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.EMAIL"> <template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.EMAIL">
<input v-model="label.value[0]" size="small" /> <el-input v-model="label.value[0]" size="small"/>
</template> </template>
</template> </template>
</el-form-item> </el-form-item>
@@ -645,6 +645,21 @@ export default {
params.parent = {} params.parent = {}
params.pid = '-1' params.pid = '-1'
} }
if (params.fields) {
params.fields.forEach(field => {
if (field.type.toUpperCase() === assetConstants.labelTypeData.CHECKBOX) { // 控制 check 选择中的顺序 跟 创建的一致
const arr = []
const items = JSON.parse(field.param).items
items.forEach(item => {
const findItem = field.value.find(fieldValue => fieldValue == item.name)
if (findItem) {
arr.push(item.name)
}
})
field.value = arr
}
})
}
if (params.id) { if (params.id) {
this.$put(this.url, params).then(res => { this.$put(this.url, params).then(res => {
this.prevent_opt.save = false this.prevent_opt.save = false

View File

@@ -50,7 +50,7 @@
</el-form-item> </el-form-item>
<div class="right-box-sub-title" style="margin-bottom: 20px" v-if="showParam"> <div class="right-box-sub-title" style="margin-bottom: 20px" v-if="showParam">
<span>{{$t('config.assetLabel.params')}}</span> <span>{{$t('config.assetLabel.params')}}</span>
<span v-if="editAssetMeta.type.toUpperCase()!=='DATETIME'" class="float-right" style="height: 19px;display: inline-block;line-height: 1;" @click="addParam"> <span v-if="editAssetMeta.type.toUpperCase()!=='DATETIME'&&editAssetMeta.type.toUpperCase()!=='DOUBLE'" class="float-right" style="height: 19px;display: inline-block;line-height: 1;" @click="addParam">
<span class="create-square-box"> <span class="create-square-box">
<i style="font-size: 17px; cursor: pointer;" class="nz-icon nz-icon-create-square"></i> <i style="font-size: 17px; cursor: pointer;" class="nz-icon nz-icon-create-square"></i>
</span> </span>
@@ -313,7 +313,7 @@ export default {
} }
} }
} }
if (param.type !== 'RADIO' && param.type !== 'CHECKBOX' && param.type !== 'SELECT' && param.type !== 'DATETIME') { if (param.type !== 'RADIO' && param.type !== 'CHECKBOX' && param.type !== 'SELECT' && param.type !== 'DATETIME' && param.type !== 'DOUBLE') {
delete param.param delete param.param
} else { } else {
param.param = JSON.stringify(param.param) param.param = JSON.stringify(param.param)