form-design优化代码格式,清除无用的注释与引用 (#2547)
* fix: 修复form设计器在黑暗模式下的显示问题 * perf: [form-design]优化源代码,清除无用注释与注释
This commit is contained in:
parent
334a0ea8e5
commit
e1804bd866
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,4 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- <component :is="layoutTag" v-bind="schema.colProps"> -->
|
|
||||||
<template v-if="['Grid'].includes(schema.component)">
|
<template v-if="['Grid'].includes(schema.component)">
|
||||||
<Row class="grid-row">
|
<Row class="grid-row">
|
||||||
<Col
|
<Col
|
||||||
|
|
@ -36,7 +35,6 @@
|
||||||
<slot :name="schema.componentProps!.slotName"></slot>
|
<slot :name="schema.componentProps!.slotName"></slot>
|
||||||
</template>
|
</template>
|
||||||
</VFormItem>
|
</VFormItem>
|
||||||
<!-- </component> -->
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, PropType } from 'vue';
|
import { defineComponent, PropType } from 'vue';
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/29
|
|
||||||
* @Description: 表单渲染器,根据json生成表单
|
* @Description: 表单渲染器,根据json生成表单
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="v-form-container">
|
<div class="v-form-container">
|
||||||
<Form class="v-form-model" ref="eFormModel" :model="formModel" v-bind="formModelProps">
|
<Form class="v-form-model" ref="eFormModel" :model="formModel" v-bind="formModelProps">
|
||||||
<Row>
|
<Row>
|
||||||
<!-- <component :is="wrapperComp"> -->
|
|
||||||
<FormRender
|
<FormRender
|
||||||
v-for="(schema, index) of noHiddenList"
|
v-for="(schema, index) of noHiddenList"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|
@ -26,7 +23,6 @@
|
||||||
></slot>
|
></slot>
|
||||||
</template>
|
</template>
|
||||||
</FormRender>
|
</FormRender>
|
||||||
<!-- </component> -->
|
|
||||||
</Row>
|
</Row>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -104,7 +100,6 @@
|
||||||
const { field } = unref(schema);
|
const { field } = unref(schema);
|
||||||
|
|
||||||
linkOn[field!]?.forEach((formItem) => {
|
linkOn[field!]?.forEach((formItem) => {
|
||||||
// console.log('handleChange', formItem, field, value);
|
|
||||||
formItem.update?.(value, formItem, fApi.value as IVFormMethods);
|
formItem.update?.(value, formItem, fApi.value as IVFormMethods);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/12/7
|
|
||||||
* @Description: 渲染代码
|
* @Description: 渲染代码
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/26
|
|
||||||
* @Description: 组件属性控件
|
* @Description: 组件属性控件
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -33,7 +31,6 @@
|
||||||
v-model:value="formConfig.currentItem.componentProps[item.name]"
|
v-model:value="formConfig.currentItem.componentProps[item.name]"
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<!-- </Row> -->
|
|
||||||
<FormItem label="控制属性">
|
<FormItem label="控制属性">
|
||||||
<Col v-for="item in controlOptions" :key="item.name">
|
<Col v-for="item in controlOptions" :key="item.name">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|
@ -122,7 +119,6 @@
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
// 让compuated属性自动更新
|
// 让compuated属性自动更新
|
||||||
// const dummyUpdate = ref(0);
|
|
||||||
|
|
||||||
const allOptions = ref([] as Omit<IBaseFormAttrs, 'tag'>[]);
|
const allOptions = ref([] as Omit<IBaseFormAttrs, 'tag'>[]);
|
||||||
const showControlAttrs = (includes: string[] | undefined) => {
|
const showControlAttrs = (includes: string[] | undefined) => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/24
|
|
||||||
* @Description: 表单项属性
|
* @Description: 表单项属性
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/24
|
|
||||||
* @Description: 表单项属性,控件属性面板
|
* @Description: 表单项属性,控件属性面板
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -129,7 +127,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const controlPropsList = computed(() => {
|
const controlPropsList = computed(() => {
|
||||||
// console.log('const list2 = computed(() => {');
|
|
||||||
return baseFormItemControlAttrs.filter((item) => {
|
return baseFormItemControlAttrs.filter((item) => {
|
||||||
return showProps(item.exclude);
|
return showProps(item.exclude);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/19
|
|
||||||
* @Description: 拖拽节点控件
|
* @Description: 拖拽节点控件
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/11
|
|
||||||
* @Description: 节点操作复制删除控件
|
* @Description: 节点操作复制删除控件
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
<div class="options-box">
|
<div class="options-box">
|
||||||
<Input v-model:value="item.span" class="options-value" />
|
<Input v-model:value="item.span" class="options-value" />
|
||||||
<a class="options-delete" @click="deleteGridOptions(index)">
|
<a class="options-delete" @click="deleteGridOptions(index)">
|
||||||
<!-- <a-icon type="delete" /> -->
|
|
||||||
<Icon icon="ant-design:delete-outlined" />
|
<Icon icon="ant-design:delete-outlined" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -21,7 +20,6 @@
|
||||||
<Input v-model:value="item.label" />
|
<Input v-model:value="item.label" />
|
||||||
<Input v-model:value="item.value" class="options-value" />
|
<Input v-model:value="item.value" class="options-value" />
|
||||||
<a class="options-delete" @click="deleteOptions(index)">
|
<a class="options-delete" @click="deleteOptions(index)">
|
||||||
<!-- <a-icon type="delete" /> -->
|
|
||||||
<Icon icon="ant-design:delete-outlined" />
|
<Icon icon="ant-design:delete-outlined" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/23
|
|
||||||
* @Description: 右侧属性面板控件 表单属性面板
|
* @Description: 右侧属性面板控件 表单属性面板
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -89,7 +87,6 @@
|
||||||
InputNumber,
|
InputNumber,
|
||||||
Slider,
|
Slider,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
// RadioButtonGroup,
|
|
||||||
RadioGroup: Radio.Group,
|
RadioGroup: Radio.Group,
|
||||||
RadioButton: Radio.Button,
|
RadioButton: Radio.Button,
|
||||||
Form,
|
Form,
|
||||||
|
|
@ -97,7 +94,6 @@
|
||||||
Col,
|
Col,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
// const labelColspan = computed(()=>)
|
|
||||||
const { formConfig } = useFormDesignState();
|
const { formConfig } = useFormDesignState();
|
||||||
|
|
||||||
formConfig.value = formConfig.value || {
|
formConfig.value = formConfig.value || {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/12/7
|
|
||||||
* @Description: 导入JSON模板
|
* @Description: 导入JSON模板
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -17,7 +15,6 @@
|
||||||
>
|
>
|
||||||
<p class="hint-box">导入格式如下:</p>
|
<p class="hint-box">导入格式如下:</p>
|
||||||
<div class="v-json-box">
|
<div class="v-json-box">
|
||||||
<!-- <CodeEditor style="height: 100%" ref="myEditor" v-model="json"></CodeEditor> -->
|
|
||||||
<CodeEditor v-model:value="json" ref="myEditor" :mode="MODE.JSON" />
|
<CodeEditor v-model:value="json" ref="myEditor" :mode="MODE.JSON" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -91,7 +88,6 @@
|
||||||
};
|
};
|
||||||
const handleImportJson = () => {
|
const handleImportJson = () => {
|
||||||
// 导入JSON
|
// 导入JSON
|
||||||
console.log(state.json);
|
|
||||||
try {
|
try {
|
||||||
const editorJsonData = JSON.parse(state.json) as IFormConfig;
|
const editorJsonData = JSON.parse(state.json) as IFormConfig;
|
||||||
editorJsonData.schemas &&
|
editorJsonData.schemas &&
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/23
|
|
||||||
* @Description: 渲染JSON数据
|
* @Description: 渲染JSON数据
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/19
|
|
||||||
* @Description: 表单项布局控件
|
* @Description: 表单项布局控件
|
||||||
* 千万不要在template下面的第一行加注释,因为这里拖动的第一个元素
|
* 千万不要在template下面的第一行加注释,因为这里拖动的第一个元素
|
||||||
-->
|
-->
|
||||||
|
|
@ -20,8 +18,6 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
:span="colItem.span"
|
:span="colItem.span"
|
||||||
>
|
>
|
||||||
<!-- <div class="draggable-box"> -->
|
|
||||||
<!-- <div class="list-main"> -->
|
|
||||||
<draggable
|
<draggable
|
||||||
class="list-main draggable-box"
|
class="list-main draggable-box"
|
||||||
:component-data="{ name: 'list', tag: 'div', type: 'transition-group' }"
|
:component-data="{ name: 'list', tag: 'div', type: 'transition-group' }"
|
||||||
|
|
@ -36,7 +32,6 @@
|
||||||
@start="$emit('dragStart', $event, colItem.children)"
|
@start="$emit('dragStart', $event, colItem.children)"
|
||||||
@add="$emit('handleColAdd', $event, colItem.children)"
|
@add="$emit('handleColAdd', $event, colItem.children)"
|
||||||
>
|
>
|
||||||
<!-- <transition-group tag="div" name="list" class="list-main"> -->
|
|
||||||
<template #item="{ element }">
|
<template #item="{ element }">
|
||||||
<LayoutItem
|
<LayoutItem
|
||||||
class="drag-move"
|
class="drag-move"
|
||||||
|
|
@ -46,10 +41,7 @@
|
||||||
@handle-delete="$emit('handle-delete')"
|
@handle-delete="$emit('handle-delete')"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<!-- </transition-group> -->
|
|
||||||
</draggable>
|
</draggable>
|
||||||
<!-- </div> -->
|
|
||||||
<!-- </div> -->
|
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<FormNodeOperate :schema="schema" :currentItem="currentItem" />
|
<FormNodeOperate :schema="schema" :currentItem="currentItem" />
|
||||||
|
|
@ -130,6 +122,5 @@
|
||||||
|
|
||||||
.hidden-item {
|
.hidden-item {
|
||||||
background-color: rgb(240, 191, 195);
|
background-color: rgb(240, 191, 195);
|
||||||
//opacity: 0.5;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/25
|
|
||||||
* @Description: 正则校验选项组件
|
* @Description: 正则校验选项组件
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1046,13 +1046,13 @@ const componentAttrs: IBaseComponentProps = {
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
ColorPicker: [
|
// ColorPicker: [
|
||||||
{
|
// {
|
||||||
name: 'defaultValue',
|
// name: 'defaultValue',
|
||||||
label: '默认值',
|
// label: '默认值',
|
||||||
component: 'AColorPicker',
|
// component: 'AColorPicker',
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
slot: [
|
slot: [
|
||||||
{
|
{
|
||||||
name: 'slotName',
|
name: 'slotName',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<Layout>
|
<Layout>
|
||||||
<LayoutSider
|
<LayoutSider
|
||||||
class="left sider"
|
:class="`left ${prefixCls}-sider`"
|
||||||
collapsible
|
collapsible
|
||||||
collapsedWidth="0"
|
collapsedWidth="0"
|
||||||
width="270"
|
width="270"
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
/>
|
/>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
<LayoutSider
|
<LayoutSider
|
||||||
class="right sider"
|
:class="`right ${prefixCls}-sider`"
|
||||||
collapsible
|
collapsible
|
||||||
:reverseArrow="true"
|
:reverseArrow="true"
|
||||||
collapsedWidth="0"
|
collapsedWidth="0"
|
||||||
|
|
@ -102,6 +102,7 @@
|
||||||
import { useRefHistory, UseRefHistoryReturn } from '@vueuse/core';
|
import { useRefHistory, UseRefHistoryReturn } from '@vueuse/core';
|
||||||
import { globalConfigState } from './config/formItemPropsConfig';
|
import { globalConfigState } from './config/formItemPropsConfig';
|
||||||
import { IFormDesignMethods, IPropsPanel, IToolbarMethods } from '../../typings/form-type';
|
import { IFormDesignMethods, IPropsPanel, IToolbarMethods } from '../../typings/form-type';
|
||||||
|
import { useDesign } from '/@/hooks/web/useDesign';
|
||||||
|
|
||||||
import { CollapseContainer } from '/@/components/Container/index';
|
import { CollapseContainer } from '/@/components/Container/index';
|
||||||
defineProps({
|
defineProps({
|
||||||
|
|
@ -110,6 +111,7 @@
|
||||||
default: 'v-form-antd表单设计器',
|
default: 'v-form-antd表单设计器',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const { prefixCls } = useDesign('form-design');
|
||||||
// 子组件实例
|
// 子组件实例
|
||||||
const propsPanel = ref<null | IPropsPanel>(null);
|
const propsPanel = ref<null | IPropsPanel>(null);
|
||||||
const jsonModal = ref<null | IToolbarMethods>(null);
|
const jsonModal = ref<null | IToolbarMethods>(null);
|
||||||
|
|
@ -135,18 +137,7 @@
|
||||||
},
|
},
|
||||||
activeKey: 1,
|
activeKey: 1,
|
||||||
});
|
});
|
||||||
// const _state = reactive<IState>({
|
|
||||||
// locale: zhCN, // 国际化
|
|
||||||
// baseComponents, // 基础控件列表
|
|
||||||
// layoutComponents, // 布局组件列表
|
|
||||||
// customComponents,
|
|
||||||
// propsPanel,
|
|
||||||
// jsonModal,
|
|
||||||
// eFormPreview,
|
|
||||||
// eFormPreview2,
|
|
||||||
// importJsonModal,
|
|
||||||
// codeModal,
|
|
||||||
// });
|
|
||||||
const setFormConfig = (config: IFormConfig) => {
|
const setFormConfig = (config: IFormConfig) => {
|
||||||
//外部导入时,可能会缺少必要的信息。
|
//外部导入时,可能会缺少必要的信息。
|
||||||
config.schemas = config.schemas || [];
|
config.schemas = config.schemas || [];
|
||||||
|
|
@ -198,24 +189,13 @@
|
||||||
* @param schemas
|
* @param schemas
|
||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
const handleAddAttrs = (_formItems: IVFormComponent[], _index: number) => {
|
const handleAddAttrs = (_formItems: IVFormComponent[], _index: number) => {};
|
||||||
// const item = schemas[index];
|
|
||||||
// setGlobalConfigState(item);
|
|
||||||
// generateKey(item);
|
|
||||||
// handleListPush(item);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleListPushDrag = (item: IVFormComponent) => {
|
const handleListPushDrag = (item: IVFormComponent) => {
|
||||||
const formItem = cloneDeep(item);
|
const formItem = cloneDeep(item);
|
||||||
setGlobalConfigState(formItem);
|
setGlobalConfigState(formItem);
|
||||||
generateKey(formItem);
|
generateKey(formItem);
|
||||||
// if (!formConfig.value.currentItem?.key) {
|
|
||||||
// formConfig.value.schemas.push(formItem);
|
|
||||||
// handleSetSelectItem(formItem);
|
|
||||||
// return formItem;
|
|
||||||
// }
|
|
||||||
// handleCopy(formItem, false);
|
|
||||||
// handleCopy(formItem, false);
|
|
||||||
return formItem;
|
return formItem;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
|
@ -354,8 +334,16 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.sider {
|
@prefix-cls: ~'@{namespace}-form-design';
|
||||||
//需要设置背景色,让主题生效
|
|
||||||
background-color: @component-background;
|
[data-theme='dark'] {
|
||||||
|
.@{prefix-cls}-sider{
|
||||||
|
background-color: #1f1f1f;
|
||||||
|
}}
|
||||||
|
|
||||||
|
[data-theme='light'] {
|
||||||
|
.@{prefix-cls}-sider{
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/18
|
|
||||||
* @Description: 中间表单布局面板
|
* @Description: 中间表单布局面板
|
||||||
* https://github.com/SortableJS/vue.draggable.next/issues/138
|
* https://github.com/SortableJS/vue.draggable.next/issues/138
|
||||||
-->
|
-->
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/19
|
|
||||||
* @Description: 右侧属性配置面板
|
* @Description: 右侧属性配置面板
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/23
|
|
||||||
* @Description: 工具栏
|
* @Description: 工具栏
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -10,20 +8,17 @@
|
||||||
<div class="left-btn-box">
|
<div class="left-btn-box">
|
||||||
<Tooltip v-for="item in toolbarsConfigs" :title="item.title" :key="item.icon">
|
<Tooltip v-for="item in toolbarsConfigs" :title="item.title" :key="item.icon">
|
||||||
<a @click="$emit(item.event)" class="toolbar-text">
|
<a @click="$emit(item.event)" class="toolbar-text">
|
||||||
<!-- <a-icon :type="item.icon" /> -->
|
|
||||||
<Icon :icon="item.icon" />
|
<Icon :icon="item.icon" />
|
||||||
</a>
|
</a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Divider type="vertical" />
|
<Divider type="vertical" />
|
||||||
<Tooltip title="撤销">
|
<Tooltip title="撤销">
|
||||||
<a :class="{ disabled: !canUndo }" :disabled="!canUndo" @click="undo">
|
<a :class="{ disabled: !canUndo }" :disabled="!canUndo" @click="undo">
|
||||||
<!-- <a-icon type="undo" /> -->
|
|
||||||
<Icon icon="ant-design:undo-outlined" />
|
<Icon icon="ant-design:undo-outlined" />
|
||||||
</a>
|
</a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="重做">
|
<Tooltip title="重做">
|
||||||
<a :class="{ disabled: !canRedo }" :disabled="!canRedo" @click="redo">
|
<a :class="{ disabled: !canRedo }" :disabled="!canRedo" @click="redo">
|
||||||
<!-- <a-icon type="redo" /> -->
|
|
||||||
<Icon icon="ant-design:redo-outlined" />
|
<Icon icon="ant-design:redo-outlined" />
|
||||||
</a>
|
</a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
@ -58,19 +53,19 @@
|
||||||
}>({
|
}>({
|
||||||
toolbarsConfigs: [
|
toolbarsConfigs: [
|
||||||
{
|
{
|
||||||
title: '预览',
|
title: '预览-支持布局',
|
||||||
type: 'preview',
|
type: 'preview',
|
||||||
event: 'handlePreview',
|
event: 'handlePreview',
|
||||||
icon: 'ant-design:chrome-filled',
|
icon: 'ant-design:chrome-filled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '预览2',
|
title: '预览-不支持布局',
|
||||||
type: 'preview',
|
type: 'preview',
|
||||||
event: 'handlePreview2',
|
event: 'handlePreview2',
|
||||||
icon: 'ant-design:chrome-filled',
|
icon: 'ant-design:chrome-filled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '导入',
|
title: '导入JSON',
|
||||||
type: 'importJson',
|
type: 'importJson',
|
||||||
event: 'handleOpenImportJsonModal',
|
event: 'handleOpenImportJsonModal',
|
||||||
icon: 'ant-design:import-outlined',
|
icon: 'ant-design:import-outlined',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/19
|
|
||||||
* @Description:
|
* @Description:
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/19
|
|
||||||
* @Description:
|
* @Description:
|
||||||
`<FormItem`
|
`<FormItem`
|
||||||
:tableAction="tableAction"
|
:tableAction="tableAction"
|
||||||
|
|
@ -11,15 +9,6 @@
|
||||||
:formModel="formModel"
|
:formModel="formModel"
|
||||||
:setFormModel="setFormModel"
|
:setFormModel="setFormModel"
|
||||||
>
|
>
|
||||||
|
|
||||||
<FormItem
|
|
||||||
:tableAction="tableAction"
|
|
||||||
:formActionType="formActionType"
|
|
||||||
:schema="schemaNew"
|
|
||||||
:formProps="getProps"
|
|
||||||
:allDefaultValues="defaultValueRef"
|
|
||||||
:formModel="formModel"
|
|
||||||
>
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/29
|
|
||||||
* @Description: 渲染组件,无法使用Vben的组件
|
* @Description: 渲染组件,无法使用Vben的组件
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<Modal
|
<Modal
|
||||||
title="预览(标准Ant控件)"
|
title="预览(支持布局)"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
@ok="handleGetData"
|
@ok="handleGetData"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
|
|
@ -29,7 +27,7 @@
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, reactive, ref, toRaw, toRefs } from 'vue';
|
import { defineComponent, reactive, ref, toRefs } from 'vue';
|
||||||
import { IFormConfig } from '../../typings/v-form-component';
|
import { IFormConfig } from '../../typings/v-form-component';
|
||||||
import { IAnyObject } from '../../typings/base-type';
|
import { IAnyObject } from '../../typings/base-type';
|
||||||
import VFormCreate from '../VFormCreate/index.vue';
|
import VFormCreate from '../VFormCreate/index.vue';
|
||||||
|
|
@ -75,21 +73,16 @@
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
// console.log('handleCancel');
|
|
||||||
state.visible = false;
|
state.visible = false;
|
||||||
state.formModel = {};
|
state.formModel = {};
|
||||||
};
|
};
|
||||||
const handleGetData = async () => {
|
const handleGetData = async () => {
|
||||||
// console.log('handleGetData');
|
|
||||||
console.log(toRaw(state.formModel));
|
|
||||||
const _data = await state.fApi.submit?.();
|
const _data = await state.fApi.submit?.();
|
||||||
// console.log('handleGetData', 'end');
|
|
||||||
jsonModal.value?.showModal?.(_data);
|
jsonModal.value?.showModal?.(_data);
|
||||||
// jsonModal.value?.showModal?.(toRaw(state.formModel));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = (_data: IAnyObject) => {
|
const onSubmit = (_data: IAnyObject) => {
|
||||||
// console.log('-> data', data);
|
//
|
||||||
};
|
};
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
state.formModel = {};
|
state.formModel = {};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: ypt
|
|
||||||
* @Date: 2021/11/29
|
|
||||||
* @Description: 使用vbenForm的功能进行渲染
|
* @Description: 使用vbenForm的功能进行渲染
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<Modal
|
<Modal
|
||||||
title="预览(VbenForm)"
|
title="预览(不支持布局)"
|
||||||
:visible="state.visible"
|
:visible="state.visible"
|
||||||
@ok="handleGetData"
|
@ok="handleGetData"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
|
|
@ -66,7 +64,6 @@
|
||||||
*/
|
*/
|
||||||
const handleGetData = async () => {
|
const handleGetData = async () => {
|
||||||
let data = await validate();
|
let data = await validate();
|
||||||
console.log(data);
|
|
||||||
jsonModal.value?.showModal?.(data);
|
jsonModal.value?.showModal?.(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,6 @@ componentMap.set('RangePicker', DatePicker.RangePicker);
|
||||||
componentMap.set('WeekPicker', DatePicker.WeekPicker);
|
componentMap.set('WeekPicker', DatePicker.WeekPicker);
|
||||||
componentMap.set('TimePicker', TimePicker);
|
componentMap.set('TimePicker', TimePicker);
|
||||||
|
|
||||||
componentMap.set('ColorPicker', TimePicker);
|
|
||||||
|
|
||||||
componentMap.set('IconPicker', IconPicker);
|
componentMap.set('IconPicker', IconPicker);
|
||||||
componentMap.set('Divider', Divider);
|
componentMap.set('Divider', Divider);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
/**
|
/**
|
||||||
* @name: formItemConfig
|
|
||||||
* @author: ypt
|
|
||||||
* @date: 2021/11/18 16:25
|
|
||||||
* @description:表单配置
|
* @description:表单配置
|
||||||
*/
|
*/
|
||||||
import { IVFormComponent } from '../typings/v-form-component';
|
import { IVFormComponent } from '../typings/v-form-component';
|
||||||
|
|
@ -338,17 +335,17 @@ export const baseComponents: IVFormComponent[] = [
|
||||||
// hiddenLabel: true,
|
// hiddenLabel: true,
|
||||||
// componentProps: {},
|
// componentProps: {},
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
component: 'ColorPicker',
|
// component: 'ColorPicker',
|
||||||
label: '颜色选择器',
|
// label: '颜色选择器',
|
||||||
icon: 'carbon:color-palette',
|
// icon: 'carbon:color-palette',
|
||||||
field: '',
|
// field: '',
|
||||||
colProps: { span: 24 },
|
// colProps: { span: 24 },
|
||||||
componentProps: {
|
// componentProps: {
|
||||||
defaultValue: '',
|
// defaultValue: '',
|
||||||
value: '',
|
// value: '',
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
|
||||||
{
|
{
|
||||||
component: 'slot',
|
component: 'slot',
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
// },
|
// },
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '自定义placeholder',
|
placeholder: '自定义placeholder',
|
||||||
onChange: (e: any) => {
|
onChange: (_e: any) => {
|
||||||
console.log(e);
|
//
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,18 @@
|
||||||
// import Vue from 'vue';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
const { createMessage } = useMessage();
|
||||||
const message = Object.assign(
|
const message = Object.assign({
|
||||||
{
|
|
||||||
success: (msg: string) => {
|
success: (msg: string) => {
|
||||||
console.log(msg);
|
createMessage.success(msg);
|
||||||
},
|
},
|
||||||
error: (msg: string) => {
|
error: (msg: string) => {
|
||||||
console.error(msg);
|
createMessage.error(msg);
|
||||||
},
|
},
|
||||||
warning: (msg: string) => {
|
warning: (msg: string) => {
|
||||||
console.warn(msg);
|
createMessage.warning(msg);
|
||||||
},
|
},
|
||||||
info: (msg: string) => {
|
info: (msg: string) => {
|
||||||
console.info(msg);
|
createMessage.info(msg);
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
// Vue.prototype.$message,
|
|
||||||
);
|
|
||||||
|
|
||||||
export default message;
|
export default message;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue