表单设计、发布-穿梭框里出现的bug

dianlixunjian
滕嵩 2024-06-20 17:36:12 +08:00
parent e14321251d
commit c00e9428ce
4 changed files with 80 additions and 28 deletions

View File

@ -38,7 +38,7 @@
图斑组件 图斑组件
</Divider> </Divider>
<a-button <a-button
v-if="['Button'].includes(schema.component)" v-else-if="['Button'].includes(schema.component)"
:type="schema.componentProps.type" :type="schema.componentProps.type"
:shape="schema.componentProps.shape" :shape="schema.componentProps.shape"
:size="schema.componentProps.size" :size="schema.componentProps.size"
@ -78,6 +78,24 @@
:defaultValue="schema.defaultValue"> :defaultValue="schema.defaultValue">
</a-select> </a-select>
</div> </div>
<a-transfer
v-else-if="['Transfer'].includes(schema.component)"
:dataSource="schema.componentProps.dataSource"
:targetKeys="schema.componentProps.targetKeys"
:selectedKeys="schema.componentProps.selectedKeys"
:schema="schema"
:render="(item) => `${item.title} ${item.description}`"
:titles="schema.componentProps.titles"
:disabled="schema.componentProps.disabled"
:oneWay="schema.componentProps.oneWay"
:pagination="schema.componentProps.pagination"
:showSearch="schema.componentProps.showSearch"
:showSelectAll="schema.componentProps.showSelectAll"
@change="transferChange"
@search="transferSearch"
@selectChange="transferSelectChange"
@click="handleClick(schema)"
/>
<component <component
v-else v-else
class="v-form-item-wrapper" class="v-form-item-wrapper"
@ -258,6 +276,17 @@
setFormModel(props.schema.field!, value); setFormModel(props.schema.field!, value);
emit('change', value); emit('change', value);
}; };
// 穿-穿
const transferChange = (nextTargetKeys: string[], direction: string, moveKeys: string[]) => {
props.schema.componentProps.targetKeys = nextTargetKeys;
};
// 穿-
const transferSearch = (dir: string, value: string) => {};
// 穿-
const transferSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => {
props.schema.componentProps.selectedKeys = sourceSelectedKeys.concat(targetSelectedKeys);
};
return { return {
...toRefs(state), ...toRefs(state),
componentItem, componentItem,
@ -269,6 +298,9 @@
colPropsComputed, colPropsComputed,
selectUseOptions, selectUseOptions,
showSelectDictionaryList, showSelectDictionaryList,
transferChange,
transferSearch,
transferSelectChange,
}; };
}, },
}); });

View File

@ -365,8 +365,7 @@ export const commonComponents: IVFormComponent[] = [
field: '', field: '',
colProps: { span: 24 }, colProps: { span: 24 },
componentProps: { componentProps: {
render: (item) => item.title, titles: ['', ''],
titles: ['Source', 'Target'],
dataSource: [ dataSource: [
{ {
key: 'key-1', key: 'key-1',
@ -387,6 +386,8 @@ export const commonComponents: IVFormComponent[] = [
disabled: false, disabled: false,
}, },
], ],
targetKeys: [],
selectedKeys: [],
}, },
}, },
]; ];

View File

@ -810,24 +810,31 @@
} }
if (columnObj.table.querys) { if (columnObj.table.querys) {
columnObj.table.querys.forEach((item) => { columnObj.table.querys.forEach((item) => {
if (item.options) { // if (item.options) {
// searchFormSchema.push({
// field: item.key,
// component: item.type || 'Input',
// label: item.label,
// colProps: { span: 6 },
// componentProps: {
// options: item.options,
// },
// });
// } else {
// searchFormSchema.push({
// field: item.key,
// component: item.type || 'Input',
// label: item.label,
// colProps: { span: 6 },
// });
// }
if (['Transfer'].includes(item.type)) {
searchFormSchema.push({ searchFormSchema.push({
field: item.key, field: item.key,
component: item.type || 'Input', component: item.type,
label: item.label, label: item.label,
colProps: { span: 6 }, colProps: { span: 12 },
componentProps: { componentProps: item.componentProps,
options: item.options,
},
});
} else {
searchFormSchema.push({
field: item.key,
component: item.type || 'Input',
label: item.label,
colProps: { span: 6 },
});
}
}); });
} }
callColumns.forEach((item) => { callColumns.forEach((item) => {

View File

@ -281,16 +281,28 @@
!['Upload', 'Uploadimg', 'Password', 'Timerange', 'Datetimerange'].includes(t.component), !['Upload', 'Uploadimg', 'Password', 'Timerange', 'Datetimerange'].includes(t.component),
) )
.map((t) => { .map((t) => {
if (t.componentProps.options) { // if (t.componentProps.options) {
// return {
// key: t.field,
// label: t.label,
// type: t.component,
// options: t.componentProps.options,
// componentProps: t.componentProps,
// };
// } else {
// return {
// key: t.field,
// label: t.label,
// type: t.component,
// componentProps: t.componentProps,
// };
// }
return { return {
key: t.field, key: t.field,
label: t.label, label: t.label,
type: t.component, type: t.component,
options: t.componentProps.options, componentProps: t.componentProps,
}; };
} else {
return { key: t.field, label: t.label, type: t.component };
}
}); });
// - // -