Commit 288c8c8d by xinla

智能表单element render children空数组与省市区加载问题

1 parent e90aaa78
...@@ -70,9 +70,6 @@ export default { ...@@ -70,9 +70,6 @@ export default {
}, },
}, },
}, },
mounted() {
console.log(this.$attrs)
},
methods: { methods: {
handleSizeChange(val) { handleSizeChange(val) {
this.$emit('pagination', { page: this.currentPage, limit: val }) this.$emit('pagination', { page: this.currentPage, limit: val })
......
...@@ -526,9 +526,9 @@ ...@@ -526,9 +526,9 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
<treeNode-dialog v-model:visible="dialogVisible" title="添加选项" @commit="addNode" /> <treeNode-dialog v-model="dialogVisible" title="添加选项" @commit="addNode" />
<treeNode-dialog v-model:visible="ifEditor" title="修改选项名" @commit="EditorNode" /> <treeNode-dialog v-model="ifEditor" title="修改选项名" @commit="EditorNode" />
<icons-dialog v-model:visible="iconsVisible" :current="activeData[currentIconModel]" @select="setIcon" /> <icons-dialog v-model="iconsVisible" :current="activeData[currentIconModel]" @select="setIcon" />
</div> </div>
</template> </template>
...@@ -789,11 +789,11 @@ export default { ...@@ -789,11 +789,11 @@ export default {
addNode(data) { addNode(data) {
this.currentNode.push(data) this.currentNode.push(data)
console.log('this.currentNode', this.currentNode) // console.log('this.currentNode', this.currentNode)
}, },
EditorNode(data) { EditorNode(data) {
console.log('currentNode', this.currentNode) // console.log('currentNode', this.currentNode)
console.log('data', data) // console.log('data', data)
this.currentNode.label = data.label this.currentNode.label = data.label
this.currentNode.value = data.value this.currentNode.value = data.value
}, },
......
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
}, },
onClose() {}, onClose() {},
close() { close() {
this.$emit('update:visible', false) this.$emit('update:model-value', false)
}, },
handelConfirm() { handelConfirm() {
this.$refs.elForm.validate((valid) => { this.$refs.elForm.validate((valid) => {
......
...@@ -240,10 +240,11 @@ export const inputComponents = [ ...@@ -240,10 +240,11 @@ export const inputComponents = [
labelWidth: null, labelWidth: null,
style: { width: '100%' }, style: { width: '100%' },
ssq: '', ssq: '',
// props: { options: [],
// value: 'id', props: {
// label: 'name', value: 'id',
// }, label: 'name',
},
'show-all-levels': true, 'show-all-levels': true,
disabled: false, disabled: false,
clearable: true, clearable: true,
......
...@@ -145,33 +145,8 @@ const componentChild = { ...@@ -145,33 +145,8 @@ const componentChild = {
export default { export default {
props: ['conf'], props: ['conf'],
data() {
return {props:{
value: 'id',
label: 'name',
lazy: true,
lazyLoad(node, resolve) {
debugger
if (node.level == 0) {
getProvinceCityTree().then((data) => {
resolve(data)
})
} else {
if (node.level == 2) {
node.data.children.forEach((e) => (e.leaf = true))
}
resolve([])
}
},
}}
},
render() { render() {
const dataObject = { const dataObject = {}
// attrs: {},
// props: {},
// on: {},
// style: {},
}
const confClone = JSON.parse(JSON.stringify(this.conf)) const confClone = JSON.parse(JSON.stringify(this.conf))
const children = [] const children = []
...@@ -201,14 +176,13 @@ export default { ...@@ -201,14 +176,13 @@ export default {
// } // }
// }) // })
debugger // 配置省市区数据首次加载
if (confClone.formCodeId == 9 && !this.conf.options?.length) {
// 配置省市区数据首次懒加载 getProvinceCityTree().then((data) => {
if (confClone.formCodeId == 9) { this.conf.options= data
debugger })
dataObject.props = this.props
} }
return h(resolveComponent(this.conf.tag), dataObject, children) return h(resolveComponent(this.conf.tag), dataObject, children?.length ? children : undefined)
}, },
} }
...@@ -412,7 +412,6 @@ export default { ...@@ -412,7 +412,6 @@ export default {
this.activeFormItem(clone) this.activeFormItem(clone)
}, },
cloneComponent(origin) { cloneComponent(origin) {
debugger
const clone = JSON.parse(JSON.stringify(origin)) const clone = JSON.parse(JSON.stringify(origin))
clone.formId = this.idGlobal = uuid() clone.formId = this.idGlobal = uuid()
clone.span = formConf.span clone.span = formConf.span
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!