级联选择器, 删除行布局子元素
This commit is contained in:
@ -421,8 +421,8 @@ export const selectComponents = [
|
|||||||
style: { width: "100%" },
|
style: { width: "100%" },
|
||||||
disabled: false,
|
disabled: false,
|
||||||
clearable: true,
|
clearable: true,
|
||||||
format: "yyyy-MM-dd",
|
format: "YYYY-MM-DD",
|
||||||
"value-format": "yyyy-MM-dd",
|
"value-format": "YYYY-MM-DD",
|
||||||
readonly: false,
|
readonly: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -447,8 +447,8 @@ export const selectComponents = [
|
|||||||
"end-placeholder": "结束日期",
|
"end-placeholder": "结束日期",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
clearable: true,
|
clearable: true,
|
||||||
format: "yyyy-MM-dd",
|
format: "YYYY-MM-DD",
|
||||||
"value-format": "yyyy-MM-dd",
|
"value-format": "YYYY-MM-DD",
|
||||||
readonly: false,
|
readonly: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -66,6 +66,7 @@ function mountSlotFiles(confClone, children) {
|
|||||||
if (childObjs) {
|
if (childObjs) {
|
||||||
Object.keys(childObjs).forEach((key) => {
|
Object.keys(childObjs).forEach((key) => {
|
||||||
const childFunc = childObjs[key];
|
const childFunc = childObjs[key];
|
||||||
|
console.log(childFunc);
|
||||||
if (confClone.__slot__ && confClone.__slot__[key]) {
|
if (confClone.__slot__ && confClone.__slot__[key]) {
|
||||||
children.push(childFunc(confClone, key));
|
children.push(childFunc(confClone, key));
|
||||||
}
|
}
|
||||||
@ -217,6 +218,7 @@ export default defineComponent({
|
|||||||
render() {
|
render() {
|
||||||
const dataObject = makeDataObject();
|
const dataObject = makeDataObject();
|
||||||
const confClone = deepClone(this.$props.conf);
|
const confClone = deepClone(this.$props.conf);
|
||||||
|
console.log(this.$slots.default, "lot");
|
||||||
const children = [];
|
const children = [];
|
||||||
// 如果slots文件夹存在与当前tag同名的文件,则执行文件中的代码
|
// 如果slots文件夹存在与当前tag同名的文件,则执行文件中的代码
|
||||||
mountSlotFiles(confClone, children);
|
mountSlotFiles(confClone, children);
|
||||||
@ -225,9 +227,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
// 将json表单配置转化为vue render可以识别的 “数据对象(dataObject)”
|
// 将json表单配置转化为vue render可以识别的 “数据对象(dataObject)”
|
||||||
buildDataObject.call(this, confClone, dataObject);
|
buildDataObject.call(this, confClone, dataObject);
|
||||||
console.log(dataObject);
|
|
||||||
const Tag = formComponentsMap[this.$props.conf.__config__.tag];
|
const Tag = formComponentsMap[this.$props.conf.__config__.tag];
|
||||||
|
|
||||||
|
// return h(Tag, dataObject.attrs, children);
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
{children.length > 0 ? (
|
||||||
<Tag
|
<Tag
|
||||||
{...dataObject.attrs}
|
{...dataObject.attrs}
|
||||||
on={dataObject.on}
|
on={dataObject.on}
|
||||||
@ -235,6 +240,16 @@ export default defineComponent({
|
|||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Tag>
|
</Tag>
|
||||||
|
) : (
|
||||||
|
<Tag
|
||||||
|
{...dataObject.attrs}
|
||||||
|
on={dataObject.on}
|
||||||
|
v-model={this.$props.conf.__config__.defaultValue}
|
||||||
|
></Tag>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
|
||||||
|
// <Tag options={dataObject.attrs.options} />
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// render() {
|
// render() {
|
||||||
|
@ -37,14 +37,15 @@ const components = {
|
|||||||
const layouts = {
|
const layouts = {
|
||||||
colFormItem(
|
colFormItem(
|
||||||
// h,
|
// h,
|
||||||
currentItem
|
currentItem,
|
||||||
// index,
|
index,
|
||||||
// list
|
list
|
||||||
) {
|
) {
|
||||||
const { onActiveItem } = this.$attrs;
|
const { onActiveItem } = this.$attrs;
|
||||||
const config = currentItem.__config__;
|
const config = currentItem.__config__;
|
||||||
// console.log(arguments, "argu");
|
// console.log(arguments, "argu");
|
||||||
const child = renderChildren.apply(this, arguments);
|
const child = renderChildren.apply(this, arguments);
|
||||||
|
|
||||||
let className =
|
let className =
|
||||||
this.activeId === config.formId
|
this.activeId === config.formId
|
||||||
? "drawing-item active-from-item"
|
? "drawing-item active-from-item"
|
||||||
@ -81,7 +82,9 @@ const layouts = {
|
|||||||
// config.defaultValue = event;
|
// config.defaultValue = event;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{child}
|
{{
|
||||||
|
default: child,
|
||||||
|
}}
|
||||||
</render>
|
</render>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
{components.itemBtns.apply(this, arguments)}
|
{components.itemBtns.apply(this, arguments)}
|
||||||
@ -90,9 +93,9 @@ const layouts = {
|
|||||||
},
|
},
|
||||||
rowFormItem(
|
rowFormItem(
|
||||||
// h,
|
// h,
|
||||||
currentItem
|
currentItem,
|
||||||
// index,
|
index,
|
||||||
// list
|
list
|
||||||
) {
|
) {
|
||||||
const { onActiveItem } = this.$attrs;
|
const { onActiveItem } = this.$attrs;
|
||||||
const config = currentItem.__config__;
|
const config = currentItem.__config__;
|
||||||
@ -141,13 +144,9 @@ const layouts = {
|
|||||||
{{
|
{{
|
||||||
item: ({ element, index }) => {
|
item: ({ element, index }) => {
|
||||||
const layout = layouts[element.__config__.layout];
|
const layout = layouts[element.__config__.layout];
|
||||||
|
console.log(element, "element");
|
||||||
if (layout) {
|
if (layout) {
|
||||||
return layout.call(
|
return layout.call(this, element, index, config.children);
|
||||||
this,
|
|
||||||
element,
|
|
||||||
index,
|
|
||||||
element.__config__.children
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return layoutIsNotFound.call(this);
|
return layoutIsNotFound.call(this);
|
||||||
},
|
},
|
||||||
@ -160,9 +159,9 @@ const layouts = {
|
|||||||
},
|
},
|
||||||
raw(
|
raw(
|
||||||
// h,
|
// h,
|
||||||
currentItem
|
currentItem,
|
||||||
// index,
|
index,
|
||||||
// list
|
list
|
||||||
) {
|
) {
|
||||||
const config = currentItem.__config__;
|
const config = currentItem.__config__;
|
||||||
const child = renderChildren.apply(this, arguments);
|
const child = renderChildren.apply(this, arguments);
|
||||||
@ -171,9 +170,6 @@ const layouts = {
|
|||||||
key={config.renderKey}
|
key={config.renderKey}
|
||||||
conf={currentItem}
|
conf={currentItem}
|
||||||
onInput={(event) => {
|
onInput={(event) => {
|
||||||
// console.log(event, "oninput");
|
|
||||||
// // this.$set(config, "defaultValue", event);
|
|
||||||
// // console.log(this.currentItem.__config__.defaultValue);
|
|
||||||
this.currentItem.__config__.defaultValue = event;
|
this.currentItem.__config__.defaultValue = event;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -185,9 +181,9 @@ const layouts = {
|
|||||||
|
|
||||||
function renderChildren(
|
function renderChildren(
|
||||||
// // h,
|
// // h,
|
||||||
currentItem
|
currentItem,
|
||||||
// // index,
|
index,
|
||||||
// // list
|
list
|
||||||
) {
|
) {
|
||||||
const config = currentItem.__config__;
|
const config = currentItem.__config__;
|
||||||
// // console.log(config, "config");
|
// // console.log(config, "config");
|
||||||
|
Reference in New Issue
Block a user