级联选择器, 删除行布局子元素

This commit is contained in:
quantulr
2022-12-15 22:25:46 +08:00
parent 57bcaecc90
commit 4500b9fb77
3 changed files with 45 additions and 34 deletions

View File

@ -421,8 +421,8 @@ export const selectComponents = [
style: { width: "100%" },
disabled: false,
clearable: true,
format: "yyyy-MM-dd",
"value-format": "yyyy-MM-dd",
format: "YYYY-MM-DD",
"value-format": "YYYY-MM-DD",
readonly: false,
},
{
@ -447,8 +447,8 @@ export const selectComponents = [
"end-placeholder": "结束日期",
disabled: false,
clearable: true,
format: "yyyy-MM-dd",
"value-format": "yyyy-MM-dd",
format: "YYYY-MM-DD",
"value-format": "YYYY-MM-DD",
readonly: false,
},
{

View File

@ -66,6 +66,7 @@ function mountSlotFiles(confClone, children) {
if (childObjs) {
Object.keys(childObjs).forEach((key) => {
const childFunc = childObjs[key];
console.log(childFunc);
if (confClone.__slot__ && confClone.__slot__[key]) {
children.push(childFunc(confClone, key));
}
@ -217,6 +218,7 @@ export default defineComponent({
render() {
const dataObject = makeDataObject();
const confClone = deepClone(this.$props.conf);
console.log(this.$slots.default, "lot");
const children = [];
// 如果slots文件夹存在与当前tag同名的文件则执行文件中的代码
mountSlotFiles(confClone, children);
@ -225,9 +227,12 @@ export default defineComponent({
// 将json表单配置转化为vue render可以识别的 “数据对象dataObject
buildDataObject.call(this, confClone, dataObject);
console.log(dataObject);
const Tag = formComponentsMap[this.$props.conf.__config__.tag];
// return h(Tag, dataObject.attrs, children);
return (
<>
{children.length > 0 ? (
<Tag
{...dataObject.attrs}
on={dataObject.on}
@ -235,6 +240,16 @@ export default defineComponent({
>
{children}
</Tag>
) : (
<Tag
{...dataObject.attrs}
on={dataObject.on}
v-model={this.$props.conf.__config__.defaultValue}
></Tag>
)}
</>
// <Tag options={dataObject.attrs.options} />
);
},
// render() {

View File

@ -37,14 +37,15 @@ const components = {
const layouts = {
colFormItem(
// h,
currentItem
// index,
// list
currentItem,
index,
list
) {
const { onActiveItem } = this.$attrs;
const config = currentItem.__config__;
// console.log(arguments, "argu");
const child = renderChildren.apply(this, arguments);
let className =
this.activeId === config.formId
? "drawing-item active-from-item"
@ -81,7 +82,9 @@ const layouts = {
// config.defaultValue = event;
}}
>
{child}
{{
default: child,
}}
</render>
</el-form-item>
{components.itemBtns.apply(this, arguments)}
@ -90,9 +93,9 @@ const layouts = {
},
rowFormItem(
// h,
currentItem
// index,
// list
currentItem,
index,
list
) {
const { onActiveItem } = this.$attrs;
const config = currentItem.__config__;
@ -141,13 +144,9 @@ const layouts = {
{{
item: ({ element, index }) => {
const layout = layouts[element.__config__.layout];
console.log(element, "element");
if (layout) {
return layout.call(
this,
element,
index,
element.__config__.children
);
return layout.call(this, element, index, config.children);
}
return layoutIsNotFound.call(this);
},
@ -160,9 +159,9 @@ const layouts = {
},
raw(
// h,
currentItem
// index,
// list
currentItem,
index,
list
) {
const config = currentItem.__config__;
const child = renderChildren.apply(this, arguments);
@ -171,9 +170,6 @@ const layouts = {
key={config.renderKey}
conf={currentItem}
onInput={(event) => {
// console.log(event, "oninput");
// // this.$set(config, "defaultValue", event);
// // console.log(this.currentItem.__config__.defaultValue);
this.currentItem.__config__.defaultValue = event;
}}
>
@ -185,9 +181,9 @@ const layouts = {
function renderChildren(
// // h,
currentItem
// // index,
// // list
currentItem,
index,
list
) {
const config = currentItem.__config__;
// // console.log(config, "config");