feat : recordRule 编辑页面开发 labels数据处理方法更改

This commit is contained in:
likexuan
2022-08-09 17:55:27 +08:00
parent 958c02e743
commit 6951c09582

View File

@@ -129,7 +129,7 @@
</template>
<script>
import bus from '@/libs/bus'
import lodash from 'lodash'
import editRigthBox from '../mixin/editRigthBox'
import { arrLength } from '@/components/common/js/validate'
import promqlInput from '../../page/dashboard/explore/promqlInput'
@@ -254,12 +254,15 @@ export default {
this.editRecordRule.expr = val
},
labelsSort (obj) {
const labels = JSON.parse(JSON.parse(JSON.stringify(obj)))
const result = []
for (const key in labels) {
result.push({ label: key, value: labels[key] })
if (typeof labels != 'object') {
const labels = JSON.parse(lodash.cloneDeep(obj))
const result = []
for (const key in labels) {
result.push({ label: key, value: labels[key] })
}
return result
}
return result
return obj
}
},
watch: {