feat : recordRule 编辑页面开发
This commit is contained in:
@@ -247,6 +247,7 @@ export default {
|
||||
removeLabels (index) {
|
||||
if (this.editRecordRule.labels.length === 1) {
|
||||
this.editRecordRule.labels = [{ label: '', value: '' }]
|
||||
return
|
||||
}
|
||||
this.editRecordRule.labels.splice(index, 1)
|
||||
},
|
||||
@@ -271,12 +272,13 @@ export default {
|
||||
immediate: true,
|
||||
handler (n, o) {
|
||||
this.isEdit = true
|
||||
const editObj = lodash.cloneDeep(n)
|
||||
this.editRecordRule = {
|
||||
...n,
|
||||
type: n.type + '',
|
||||
inr: n.inr + '',
|
||||
labels: this.labelsSort(n.labels),
|
||||
state: n.state + ''
|
||||
...editObj,
|
||||
type: editObj.type + '',
|
||||
inr: editObj.inr + '',
|
||||
labels: typeof editObj.labels != 'object' ? this.labelsSort(editObj.labels) : editObj.labels,
|
||||
state: editObj.state + ''
|
||||
}
|
||||
// expression
|
||||
if (this.editRecordRule.id || this.editRecordRule.name) {
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import lodash from 'lodash'
|
||||
import table from '@/components/common/mixin/table'
|
||||
import nzAlertTag from '../../../page/alert/nzAlertTag'
|
||||
import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
||||
@@ -218,12 +219,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
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 obj != '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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user