form-designer-xinyi 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +6 -0
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/docs/.vitepress/config.ts +158 -0
- package/docs/.vitepress/theme/custom.css +38 -0
- package/docs/.vitepress/theme/index.ts +7 -0
- package/docs/.vitepress/theme/style.css +36 -0
- package/docs/guide/about/about.md +25 -0
- package/docs/guide/action/customFunctions.md +560 -0
- package/docs/guide/action/publicMethods.md +25 -0
- package/docs/guide/components/EBuilder.md +544 -0
- package/docs/guide/components/EDesigner.md +117 -0
- package/docs/guide/extensions/actionBar.md +55 -0
- package/docs/guide/extensions/component.md +113 -0
- package/docs/guide/extensions/icon.md +41 -0
- package/docs/guide/extensions/rightSidebar.md +57 -0
- package/docs/guide/start/dark-mode.md +149 -0
- package/docs/guide/start/i18n-cn.md +39 -0
- package/docs/guide/start/index.md +59 -0
- package/docs/guide/start/layoutGuide.md +0 -0
- package/docs/guide/start/quick-start.md +179 -0
- package/docs/guide/start/theme.md +122 -0
- package/docs/guide/utils/pageManager.md +97 -0
- package/docs/guide/utils/pluginManager.md +227 -0
- package/docs/index.md +41 -0
- package/docs/package.json +14 -0
- package/docs/public/dark.png +0 -0
- package/docs/public/favicon.ico +0 -0
- package/docs/public/icons/demo.css +539 -0
- package/docs/public/icons/demo_index.html +589 -0
- package/docs/public/icons/iconfont.css +379 -0
- package/docs/public/icons/iconfont.js +1 -0
- package/docs/public/icons/iconfont.json +646 -0
- package/docs/public/icons/iconfont.ttf +0 -0
- package/docs/public/icons/iconfont.woff +0 -0
- package/docs/public/icons/iconfont.woff2 +0 -0
- package/docs/public/layout.jpg +0 -0
- package/docs/public/logo.png +0 -0
- package/docs/public/theme.jpg +0 -0
- package/docs/updateLog.md +364 -0
- package/docs/vite.config.ts +18 -0
- package/docs//345/210/235/345/247/213/345/214/226/345/270/203/345/261/200.jpg +0 -0
- package/docs//350/256/276/350/256/241/345/231/250/344/273/213/347/273/215.md +21 -0
- package/docs//350/256/276/350/256/241/345/231/250/345/270/203/345/261/200.jpg +0 -0
- package/examples/README.md +18 -0
- package/examples/index.html +13 -0
- package/examples/package.json +27 -0
- package/examples/public/favicon.ico +0 -0
- package/examples/src/App.vue +5 -0
- package/examples/src/assets/logo.png +0 -0
- package/examples/src/layout/baseLayout.vue +3 -0
- package/examples/src/layout/components/Header/index.vue +102 -0
- package/examples/src/layout/components/Main/Maximize.vue +77 -0
- package/examples/src/layout/components/Main/index.vue +16 -0
- package/examples/src/layout/components/Menu/index.vue +49 -0
- package/examples/src/layout/index.vue +26 -0
- package/examples/src/main.ts +6 -0
- package/examples/src/router/index.ts +98 -0
- package/examples/src/style/reset.css +253 -0
- package/examples/src/style.less +44 -0
- package/examples/src/views/builder/basic/index.vue +182 -0
- package/examples/src/views/builder/disableDisplay/index.vue +153 -0
- package/examples/src/views/builder/disableDisplay copy/index.vue +111 -0
- package/examples/src/views/builder/loadData/index.vue +195 -0
- package/examples/src/views/builder/sum/index.vue +127 -0
- package/examples/src/views/designer/basic/index.vue +22 -0
- package/examples/src/views/designer/loadData/index.vue +186 -0
- package/examples/src/vite-env.d.ts +1 -0
- package/examples/tsconfig.json +27 -0
- package/examples/tsconfig.node.json +10 -0
- package/examples/vite.config.ts +28 -0
- package/package.json +44 -0
- package/packages/core/LICENSE +21 -0
- package/packages/core/components/asyncLoader/index.less +92 -0
- package/packages/core/components/asyncLoader/index.vue +7 -0
- package/packages/core/components/builder/index.ts +3 -0
- package/packages/core/components/builder/src/builder.vue +217 -0
- package/packages/core/components/builder/src/types.ts +4 -0
- package/packages/core/components/designer/index.ts +3 -0
- package/packages/core/components/designer/src/designer.vue +258 -0
- package/packages/core/components/designer/src/index.less +81 -0
- package/packages/core/components/designer/src/modules/actionBar/index.less +79 -0
- package/packages/core/components/designer/src/modules/actionBar/index.vue +44 -0
- package/packages/core/components/designer/src/modules/attributeView/attributeView.vue +104 -0
- package/packages/core/components/designer/src/modules/attributeView/eventView.vue +76 -0
- package/packages/core/components/designer/src/modules/attributeView/index.less +36 -0
- package/packages/core/components/designer/src/modules/attributeView/styleView.vue +103 -0
- package/packages/core/components/designer/src/modules/componentView/index.less +52 -0
- package/packages/core/components/designer/src/modules/componentView/index.vue +118 -0
- package/packages/core/components/designer/src/modules/editContainer/editNodeItem.vue +74 -0
- package/packages/core/components/designer/src/modules/editContainer/editScreenContainer.vue +142 -0
- package/packages/core/components/designer/src/modules/editContainer/index.less +129 -0
- package/packages/core/components/designer/src/modules/editContainer/index.vue +37 -0
- package/packages/core/components/designer/src/modules/editContainer/nodeItem.vue +91 -0
- package/packages/core/components/designer/src/modules/editContainer/previewJson.vue +61 -0
- package/packages/core/components/designer/src/modules/editContainer/previewWidgets.vue +373 -0
- package/packages/core/components/designer/src/modules/editContainer/toolbar.vue +248 -0
- package/packages/core/components/designer/src/modules/header/index.less +16 -0
- package/packages/core/components/designer/src/modules/header/index.vue +60 -0
- package/packages/core/components/designer/src/modules/outline/index.less +7 -0
- package/packages/core/components/designer/src/modules/outline/outline.vue +39 -0
- package/packages/core/components/designer/src/modules/preview/index.less +0 -0
- package/packages/core/components/designer/src/modules/preview/index.vue +71 -0
- package/packages/core/components/designer/src/modules/rightSidebar/breadcrumb.vue +30 -0
- package/packages/core/components/designer/src/modules/rightSidebar/index.less +75 -0
- package/packages/core/components/designer/src/modules/rightSidebar/index.vue +58 -0
- package/packages/core/components/designer/src/modules/sourceCode/index.less +7 -0
- package/packages/core/components/designer/src/modules/sourceCode/index.vue +34 -0
- package/packages/core/components/designer/src/types.ts +9 -0
- package/packages/core/components/icon/index.ts +2 -0
- package/packages/core/components/icon/src/icon.vue +15 -0
- package/packages/core/components/node/index.ts +2 -0
- package/packages/core/components/node/src/node.vue +350 -0
- package/packages/core/components/tree/index.ts +2 -0
- package/packages/core/components/tree/src/index.less +106 -0
- package/packages/core/components/tree/src/tree.vue +113 -0
- package/packages/core/components/tree/src/treeNodeItem.vue +87 -0
- package/packages/core/components/tree/src/treeNodes.vue +68 -0
- package/packages/core/extensions/EActionEditor/index.less +172 -0
- package/packages/core/extensions/EActionEditor/index.vue +160 -0
- package/packages/core/extensions/EActionEditor/src/EActionEditorItem.vue +133 -0
- package/packages/core/extensions/EActionEditor/src/EActionModal.vue +258 -0
- package/packages/core/extensions/EActionEditor/src/EArgsEditor.vue +61 -0
- package/packages/core/extensions/EActionEditor/src/EScriptEdit.vue +26 -0
- package/packages/core/extensions/EColEditor/index.less +24 -0
- package/packages/core/extensions/EColEditor/index.vue +65 -0
- package/packages/core/extensions/EInputSize/index.vue +59 -0
- package/packages/core/extensions/EOptionsEditor/index.vue +52 -0
- package/packages/core/extensions/EOptionsEditor/optionItem.vue +72 -0
- package/packages/core/extensions/ERuleEditor/ERuleItem.vue +137 -0
- package/packages/core/extensions/ERuleEditor/data.ts +24 -0
- package/packages/core/extensions/ERuleEditor/index.less +17 -0
- package/packages/core/extensions/ERuleEditor/index.vue +154 -0
- package/packages/core/extensions/ERuleEditor/types.ts +17 -0
- package/packages/core/extensions/MonacoEditor/index.ts +31 -0
- package/packages/core/extensions/MonacoEditor/index.vue +147 -0
- package/packages/core/extensions/Page/index.ts +23 -0
- package/packages/core/extensions/Page/index.vue +27 -0
- package/packages/core/extensions/index.ts +73 -0
- package/packages/core/index.less +27 -0
- package/packages/core/index.ts +35 -0
- package/packages/core/package.json +59 -0
- package/packages/core/static/icons/demo.css +539 -0
- package/packages/core/static/icons/demo_index.html +2281 -0
- package/packages/core/static/icons/iconfont.css +372 -0
- package/packages/core/static/icons/iconfont.js +1 -0
- package/packages/core/static/icons/iconfont.json +646 -0
- package/packages/core/static/icons/iconfont.ttf +0 -0
- package/packages/core/static/icons/iconfont.woff +0 -0
- package/packages/core/static/icons/iconfont.woff2 +0 -0
- package/packages/core/static/logo.png +0 -0
- package/packages/core/theme/var.less +175 -0
- package/packages/core/tsconfig.json +19 -0
- package/packages/core/types/epic-designer.ts +75 -0
- package/packages/epic-designer/.babelrc +9 -0
- package/packages/epic-designer/.eslintrc.cjs +76 -0
- package/packages/epic-designer/LICENSE +21 -0
- package/packages/epic-designer/README.md +239 -0
- package/packages/epic-designer/index.ts +13 -0
- package/packages/epic-designer/package.json +75 -0
- package/packages/epic-designer/shims-vue.d.ts +4 -0
- package/packages/epic-designer/tsconfig.json +19 -0
- package/packages/epic-designer/uno.config.ts +79 -0
- package/packages/script/package.json +17 -0
- package/packages/script/src/check-compiled.ts +22 -0
- package/packages/script/tsconfig.json +10 -0
- package/packages/ui/LICENSE +21 -0
- package/packages/ui/antd/button/button.vue +16 -0
- package/packages/ui/antd/button/index.ts +202 -0
- package/packages/ui/antd/card/card.ts +31 -0
- package/packages/ui/antd/card/index.ts +63 -0
- package/packages/ui/antd/cascader/cascader.vue +23 -0
- package/packages/ui/antd/cascader/index.ts +197 -0
- package/packages/ui/antd/checkbox/index.ts +99 -0
- package/packages/ui/antd/col/col.ts +31 -0
- package/packages/ui/antd/col/index.ts +22 -0
- package/packages/ui/antd/color-picker/index.ts +107 -0
- package/packages/ui/antd/date-picker/datePicker.ts +47 -0
- package/packages/ui/antd/date-picker/index.ts +302 -0
- package/packages/ui/antd/form/form.vue +118 -0
- package/packages/ui/antd/form/index.ts +195 -0
- package/packages/ui/antd/form-item/formItem.vue +15 -0
- package/packages/ui/antd/form-item/index.ts +11 -0
- package/packages/ui/antd/formLogic/actionEdit.vue +72 -0
- package/packages/ui/antd/formLogic/actionItem.vue +46 -0
- package/packages/ui/antd/formLogic/conditionEdit.vue +111 -0
- package/packages/ui/antd/formLogic/conditionItem.vue +150 -0
- package/packages/ui/antd/formLogic/drawer.vue +124 -0
- package/packages/ui/antd/formLogic/formLogic.vue +33 -0
- package/packages/ui/antd/formLogic/index.ts +11 -0
- package/packages/ui/antd/formLogic/types.ts +25 -0
- package/packages/ui/antd/index.less +33 -0
- package/packages/ui/antd/index.ts +323 -0
- package/packages/ui/antd/input/index.ts +169 -0
- package/packages/ui/antd/input-number/index.ts +181 -0
- package/packages/ui/antd/input-password/index.ts +152 -0
- package/packages/ui/antd/modal/index.ts +19 -0
- package/packages/ui/antd/modal/modal.vue +82 -0
- package/packages/ui/antd/radio/index.ts +105 -0
- package/packages/ui/antd/row/index.ts +114 -0
- package/packages/ui/antd/row/row.ts +31 -0
- package/packages/ui/antd/select/index.ts +228 -0
- package/packages/ui/antd/slider/index.ts +142 -0
- package/packages/ui/antd/switch/index.ts +141 -0
- package/packages/ui/antd/textarea/index.ts +162 -0
- package/packages/ui/antd/time-picker/index.ts +189 -0
- package/packages/ui/antd/upload-file/index.ts +88 -0
- package/packages/ui/antd/upload-file/uploadFile.ts +117 -0
- package/packages/ui/antd/upload-image/index.ts +69 -0
- package/packages/ui/antd/upload-image/uploadImage.vue +148 -0
- package/packages/ui/elementPlus/button/button.ts +25 -0
- package/packages/ui/elementPlus/button/index.ts +128 -0
- package/packages/ui/elementPlus/card/card.ts +36 -0
- package/packages/ui/elementPlus/card/index.ts +50 -0
- package/packages/ui/elementPlus/cascader/index.ts +216 -0
- package/packages/ui/elementPlus/checkbox/checkbox.ts +31 -0
- package/packages/ui/elementPlus/checkbox/index.ts +140 -0
- package/packages/ui/elementPlus/col/col.ts +31 -0
- package/packages/ui/elementPlus/col/index.ts +21 -0
- package/packages/ui/elementPlus/collapse/collapse.ts +32 -0
- package/packages/ui/elementPlus/collapse/index.ts +41 -0
- package/packages/ui/elementPlus/collapse-item/collapseItem.ts +31 -0
- package/packages/ui/elementPlus/collapse-item/index.ts +12 -0
- package/packages/ui/elementPlus/color-picker/index.ts +110 -0
- package/packages/ui/elementPlus/date-picker/index.ts +218 -0
- package/packages/ui/elementPlus/form/form.vue +99 -0
- package/packages/ui/elementPlus/form/index.ts +147 -0
- package/packages/ui/elementPlus/formItem/formItem.vue +15 -0
- package/packages/ui/elementPlus/formItem/index.ts +11 -0
- package/packages/ui/elementPlus/index.less +79 -0
- package/packages/ui/elementPlus/index.ts +84 -0
- package/packages/ui/elementPlus/input/index.ts +179 -0
- package/packages/ui/elementPlus/input-number/index.ts +145 -0
- package/packages/ui/elementPlus/modal/index.ts +18 -0
- package/packages/ui/elementPlus/modal/modal.ts +68 -0
- package/packages/ui/elementPlus/radio/index.ts +121 -0
- package/packages/ui/elementPlus/radio/radio.ts +32 -0
- package/packages/ui/elementPlus/row/index.ts +105 -0
- package/packages/ui/elementPlus/row/row.ts +32 -0
- package/packages/ui/elementPlus/select/index.ts +283 -0
- package/packages/ui/elementPlus/select/select.ts +31 -0
- package/packages/ui/elementPlus/slider/index.ts +237 -0
- package/packages/ui/elementPlus/switch/index.ts +159 -0
- package/packages/ui/elementPlus/textarea/index.ts +154 -0
- package/packages/ui/elementPlus/upload-file/index.ts +86 -0
- package/packages/ui/elementPlus/upload-file/uploadFile.ts +114 -0
- package/packages/ui/elementPlus/upload-image/index.ts +86 -0
- package/packages/ui/elementPlus/upload-image/uploadImage.ts +151 -0
- package/packages/ui/hooks/index.ts +1 -0
- package/packages/ui/hooks/logic.ts +129 -0
- package/packages/ui/index.ts +22 -0
- package/packages/ui/naiveUi/button/button.ts +25 -0
- package/packages/ui/naiveUi/button/index.ts +146 -0
- package/packages/ui/naiveUi/card/card.ts +32 -0
- package/packages/ui/naiveUi/card/index.ts +25 -0
- package/packages/ui/naiveUi/cascader/index.ts +218 -0
- package/packages/ui/naiveUi/checkbox/checkbox.ts +27 -0
- package/packages/ui/naiveUi/checkbox/index.ts +114 -0
- package/packages/ui/naiveUi/col/col.ts +30 -0
- package/packages/ui/naiveUi/col/index.ts +21 -0
- package/packages/ui/naiveUi/collapse/collapse.ts +31 -0
- package/packages/ui/naiveUi/collapse/index.ts +40 -0
- package/packages/ui/naiveUi/collapse-item/collapseItem.ts +31 -0
- package/packages/ui/naiveUi/collapse-item/index.ts +12 -0
- package/packages/ui/naiveUi/color-picker/index.ts +179 -0
- package/packages/ui/naiveUi/date-picker/index.ts +210 -0
- package/packages/ui/naiveUi/form/form.vue +85 -0
- package/packages/ui/naiveUi/form/index.ts +141 -0
- package/packages/ui/naiveUi/form-item/formItem.vue +15 -0
- package/packages/ui/naiveUi/form-item/index.ts +10 -0
- package/packages/ui/naiveUi/index.less +33 -0
- package/packages/ui/naiveUi/index.ts +80 -0
- package/packages/ui/naiveUi/input/index.ts +215 -0
- package/packages/ui/naiveUi/input-number/index.ts +141 -0
- package/packages/ui/naiveUi/modal/index.ts +18 -0
- package/packages/ui/naiveUi/modal/modal.ts +83 -0
- package/packages/ui/naiveUi/radio/index.ts +94 -0
- package/packages/ui/naiveUi/radio/radio.ts +27 -0
- package/packages/ui/naiveUi/row/index.ts +105 -0
- package/packages/ui/naiveUi/row/row.ts +31 -0
- package/packages/ui/naiveUi/select/index.ts +193 -0
- package/packages/ui/naiveUi/slider/index.ts +181 -0
- package/packages/ui/naiveUi/switch/index.ts +133 -0
- package/packages/ui/naiveUi/upload-file/index.ts +82 -0
- package/packages/ui/naiveUi/upload-file/uploadFile.ts +78 -0
- package/packages/ui/naiveUi/upload-image/index.ts +82 -0
- package/packages/ui/naiveUi/upload-image/uploadImage.ts +152 -0
- package/packages/ui/package.json +18 -0
- package/packages/ui/tsconfig.json +19 -0
- package/packages/utils/LICENSE +21 -0
- package/packages/utils/common/common.ts +18 -0
- package/packages/utils/common/component.ts +22 -0
- package/packages/utils/common/data.ts +682 -0
- package/packages/utils/common/element.ts +166 -0
- package/packages/utils/common/index.ts +6 -0
- package/packages/utils/common/string.ts +18 -0
- package/packages/utils/common/theme.ts +84 -0
- package/packages/utils/index.ts +3 -0
- package/packages/utils/manager/index.ts +3 -0
- package/packages/utils/manager/pageManager.ts +157 -0
- package/packages/utils/manager/pluginManager.ts +586 -0
- package/packages/utils/manager/revoke.ts +128 -0
- package/packages/utils/package.json +7 -0
- package/packages/utils/shareStore/index.ts +30 -0
- package/packages/utils/tsconfig.json +19 -0
- package/packages/utils/vite.config.ts +39 -0
- package/pnpm-workspace.yaml +5 -0
- package/turbo.json +20 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mb-2 w-full">
|
|
3
|
+
<Space>
|
|
4
|
+
<Select class="w-100px" v-model:value="innerValue.trigger" :options="props.triggerOptions"
|
|
5
|
+
placeholder="选择动作"></Select>
|
|
6
|
+
<div class="flex w-340px">
|
|
7
|
+
<Select class="flex-1" v-model:value="innerValue.field" :options="props.fieldOptions"
|
|
8
|
+
placeholder="选择字段"></Select>
|
|
9
|
+
<Select v-if="innerValue.trigger === 'setValue'" class="flex-1 ml-2" v-model:value="innerValue.value"
|
|
10
|
+
:options="props.fieldOptions" placeholder="选择字段"></Select>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="w-28px h-28px cursor-pointer bg-red-100 text-red-400 hover:bg-red-400 border-solid border-1px border-red-300 rounded-full flex justify-center items-center hover:text-white"
|
|
13
|
+
@click="handleDelete">
|
|
14
|
+
<span class="iconfont epic-icon-shanchu1" />
|
|
15
|
+
</div>
|
|
16
|
+
</Space>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import { useVModel } from '@vueuse/core'
|
|
21
|
+
import { ActionItem } from './types'
|
|
22
|
+
import { Space, Select } from 'ant-design-vue'
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits(['update:modelValue', 'delete'])
|
|
25
|
+
|
|
26
|
+
const props = defineProps<{
|
|
27
|
+
modelValue: ActionItem;
|
|
28
|
+
fieldOptions: {
|
|
29
|
+
label: string | undefined,
|
|
30
|
+
value: string | undefined
|
|
31
|
+
}[];
|
|
32
|
+
triggerOptions: {
|
|
33
|
+
label: string | undefined,
|
|
34
|
+
value: string | undefined
|
|
35
|
+
}[];
|
|
36
|
+
}>()
|
|
37
|
+
const innerValue = useVModel(props, 'modelValue', emit)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
function handleDelete() {
|
|
43
|
+
emit('delete')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex">
|
|
3
|
+
<div class="logical-operator" v-if="innerValue.conditions.length">
|
|
4
|
+
<div class="logical-operator__line"></div>
|
|
5
|
+
<Switch v-model:checked="innerValue.operator" checked-children="且" checkedValue="and" unCheckedValue="or"
|
|
6
|
+
un-checked-children="或" />
|
|
7
|
+
</div>
|
|
8
|
+
<div class="flex-1">
|
|
9
|
+
<ConditionItem v-model="innerValue.conditions[index]" v-for="(_condition, index) in innerValue.conditions"
|
|
10
|
+
:key="index" :fieldOptions="fieldOptions" @delete="handleDelete(index)" />
|
|
11
|
+
|
|
12
|
+
<Button class="w-100%" type="dashed" @click="handleAdd">
|
|
13
|
+
<template #icon>
|
|
14
|
+
<span class="iconfont epic-icon-tianjia mr-1" />
|
|
15
|
+
</template>
|
|
16
|
+
添加条件
|
|
17
|
+
</Button>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { useVModel } from '@vueuse/core'
|
|
24
|
+
import { Condition } from './types'
|
|
25
|
+
import { Switch, Button, Select } from 'ant-design-vue'
|
|
26
|
+
import { Designer } from '@epic-designer/core'
|
|
27
|
+
import { getFormSchemas } from '@epic-designer/utils'
|
|
28
|
+
import { inject, computed } from 'vue'
|
|
29
|
+
import ConditionItem from './conditionItem.vue'
|
|
30
|
+
const designer = inject('designer') as Designer
|
|
31
|
+
|
|
32
|
+
const checkedNode = computed(() => {
|
|
33
|
+
return designer.state.checkedNode
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const fieldOptions = computed(() => {
|
|
37
|
+
return getFormSchemas([checkedNode.value!], checkedNode.value?.componentProps.name).map(item => ({ label: item.label, value: item.field })).reverse()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const props = defineProps<{
|
|
41
|
+
modelValue: Condition
|
|
42
|
+
}>()
|
|
43
|
+
const emit = defineEmits(['update:modelValue'])
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const innerValue = useVModel(props, 'modelValue', emit)
|
|
48
|
+
|
|
49
|
+
function handleAdd() {
|
|
50
|
+
|
|
51
|
+
innerValue.value.conditions.push({
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function handleDelete(index) {
|
|
57
|
+
innerValue.value.conditions.splice(index, 1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style lang="less" scoped>
|
|
63
|
+
.logical-operator {
|
|
64
|
+
width: 60px;
|
|
65
|
+
position: relative;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
|
|
69
|
+
.logical-operator__line {
|
|
70
|
+
position: absolute;
|
|
71
|
+
left: calc(32% - 1px);
|
|
72
|
+
height: calc(100% - 28px);
|
|
73
|
+
width: 30px;
|
|
74
|
+
border-width: 1px 0 1px 1px;
|
|
75
|
+
border-top-style: solid;
|
|
76
|
+
border-bottom-style: solid;
|
|
77
|
+
border-left-style: solid;
|
|
78
|
+
border-top-color: var(--epic-border-color);
|
|
79
|
+
border-bottom-color: var(--epic-border-color);
|
|
80
|
+
border-left-color: var(--epic-border-color);
|
|
81
|
+
border-image: initial;
|
|
82
|
+
border-right-style: initial;
|
|
83
|
+
border-right-color: initial;
|
|
84
|
+
border-radius: 5px 0 0 5px;
|
|
85
|
+
|
|
86
|
+
&:before {
|
|
87
|
+
content: "";
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: 0;
|
|
90
|
+
right: 0;
|
|
91
|
+
transform: translate(100%) translateY(-50%);
|
|
92
|
+
width: 8px;
|
|
93
|
+
height: 8px;
|
|
94
|
+
border: 1px solid var(--epic-border-color);
|
|
95
|
+
border-radius: 50%
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:after {
|
|
99
|
+
content: "";
|
|
100
|
+
position: absolute;
|
|
101
|
+
bottom: 0;
|
|
102
|
+
right: 0;
|
|
103
|
+
transform: translate(100%) translateY(50%);
|
|
104
|
+
width: 8px;
|
|
105
|
+
height: 8px;
|
|
106
|
+
border: 1px solid var(--epic-border-color);
|
|
107
|
+
border-radius: 50%
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mb-4">
|
|
3
|
+
<Space>
|
|
4
|
+
<Select class="w-100px" v-model:value="innerValue.field" :options="props.fieldOptions"
|
|
5
|
+
placeholder="选择字段"></Select>
|
|
6
|
+
<Select v-model:value="innerValue.operator" class="w-90px" v-if="innerValue.field"
|
|
7
|
+
:options="operatorOptions" placeholder="选择判断条件"></Select>
|
|
8
|
+
<ENode
|
|
9
|
+
v-if="innerValue.field && innerValue.operator && showValueComponentOperators.includes(innerValue.operator)"
|
|
10
|
+
v-model="innerValue.value" :component-schema="{ ...currentNode, noFormItem: true }"></ENode>
|
|
11
|
+
<div class="w-28px h-28px cursor-pointer bg-red-100 text-red-400 hover:bg-red-400 border-solid border-1px border-red-300 rounded-full flex justify-center items-center hover:text-white"
|
|
12
|
+
@click="handleDelete">
|
|
13
|
+
<span class="iconfont epic-icon-shanchu1" />
|
|
14
|
+
</div>
|
|
15
|
+
</Space>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
import { useVModel } from '@vueuse/core'
|
|
20
|
+
import { ConditionItem } from './types'
|
|
21
|
+
import { Space, Select } from 'ant-design-vue'
|
|
22
|
+
import { Designer, ComponentSchema, ENode } from '@epic-designer/core'
|
|
23
|
+
import { findSchemas } from '@epic-designer/utils'
|
|
24
|
+
|
|
25
|
+
import { inject, computed, watch } from 'vue'
|
|
26
|
+
const designer = inject('designer') as Designer
|
|
27
|
+
const emit = defineEmits(['update:modelValue', 'delete'])
|
|
28
|
+
|
|
29
|
+
const props = defineProps<{
|
|
30
|
+
modelValue: ConditionItem,
|
|
31
|
+
fieldOptions: {
|
|
32
|
+
label: string | undefined,
|
|
33
|
+
value: string | undefined
|
|
34
|
+
}[]
|
|
35
|
+
}>()
|
|
36
|
+
const innerValue = useVModel(props, 'modelValue', emit)
|
|
37
|
+
|
|
38
|
+
const checkedNode = computed(() => {
|
|
39
|
+
return designer.state.checkedNode
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const currentNode = computed(() => {
|
|
43
|
+
const currentNode = findSchemas([checkedNode.value!], item => {
|
|
44
|
+
return item.field === innerValue.value.field
|
|
45
|
+
}, true) as ComponentSchema
|
|
46
|
+
return currentNode
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const baseOperatorOptions = [
|
|
53
|
+
{
|
|
54
|
+
label: '等于',
|
|
55
|
+
value: 'eq'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: '不等于',
|
|
59
|
+
value: 'neq'
|
|
60
|
+
},
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
const numberOperatorOptions = [
|
|
65
|
+
{
|
|
66
|
+
label: '大于',
|
|
67
|
+
value: 'gt'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
label: '大于等于',
|
|
71
|
+
value: 'gte'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: '小于',
|
|
75
|
+
value: 'lt'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: '小于等于',
|
|
79
|
+
value: 'lte'
|
|
80
|
+
},
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
const includeOperatorOptions = [
|
|
84
|
+
{
|
|
85
|
+
label: '包含',
|
|
86
|
+
value: 'in'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: '不包含',
|
|
90
|
+
value: 'nin'
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
const showValueComponentOperators = [...baseOperatorOptions.map(item => item.value), ...numberOperatorOptions.map(item => item.value), ...includeOperatorOptions.map(item => item.value)]
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
const operatorOptions = computed(() => {
|
|
99
|
+
const options = [
|
|
100
|
+
{
|
|
101
|
+
label: '为空',
|
|
102
|
+
value: 'null'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
label: '非空',
|
|
106
|
+
value: 'notNull'
|
|
107
|
+
},
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
if (['input', 'textarea', 'password', 'select'].includes(currentNode.value.type)) {
|
|
112
|
+
options.unshift(...includeOperatorOptions)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (['number'].includes(currentNode.value.type)) {
|
|
116
|
+
options.unshift(...numberOperatorOptions)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (['input', 'number', 'textarea', 'password', 'radio', 'checkbox', 'select', 'slider', 'time', 'date', 'cascader', 'switch', 'color-picker','JSelectDept','JSelectMultiple','JDictSelectTag','classifiedDictionary','selectUser'].includes(currentNode.value.type)) {
|
|
120
|
+
options.unshift(...baseOperatorOptions)
|
|
121
|
+
}
|
|
122
|
+
// mapLocation
|
|
123
|
+
// signature
|
|
124
|
+
// text
|
|
125
|
+
// downLoad
|
|
126
|
+
// uploadFile
|
|
127
|
+
// areaSelect
|
|
128
|
+
// selectUser
|
|
129
|
+
// classifiedDictionary
|
|
130
|
+
// JDictSelectTag
|
|
131
|
+
// JSelectMultiple
|
|
132
|
+
// JSelectDept
|
|
133
|
+
// inputIdCard
|
|
134
|
+
|
|
135
|
+
return options
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
watch(() => operatorOptions.value, options => {
|
|
139
|
+
innerValue.value.operator = options[0].value
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
function handleDelete() {
|
|
147
|
+
emit('delete')
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
</script>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Drawer class="epic-drawer-form-logic" width="550px" title="逻辑规则" v-model:open="open">
|
|
3
|
+
<div class="epic-drawer-container h-full">
|
|
4
|
+
<div class="h-full overflow-auto">
|
|
5
|
+
<Button class="w-full" type="primary" @click="handleAdd">
|
|
6
|
+
<template #icon>
|
|
7
|
+
<span class="iconfont epic-icon-tianjia mr-1" />
|
|
8
|
+
</template>
|
|
9
|
+
添加逻辑规则
|
|
10
|
+
</Button>
|
|
11
|
+
|
|
12
|
+
<Card v-for="(rule, index) in logicRules" :key="index" class="mt-2" :bodyStyle="{ padding: '16px' }">
|
|
13
|
+
<div class="absolute top-8px right-8px cursor-pointer rounded-full w-24px h-24px text-16px flex items-center justify-center hover:bg-gray-100 rotate-45"
|
|
14
|
+
@click=handleDelete(index)>
|
|
15
|
+
<span class="iconfont epic-icon-tianjia" />
|
|
16
|
+
</div>
|
|
17
|
+
<Divider>当满足以下条件时</Divider>
|
|
18
|
+
<ConditionEdit v-model="rule.condition" />
|
|
19
|
+
<Divider>则执行</Divider>
|
|
20
|
+
<ActionEdit v-model="rule.actions" />
|
|
21
|
+
</Card>
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="epic-modal-footer">
|
|
26
|
+
<Space align="end">
|
|
27
|
+
<Button @click="handleClose">关闭</Button>
|
|
28
|
+
<Button type="primary" @click="handleOk">
|
|
29
|
+
确定
|
|
30
|
+
</Button>
|
|
31
|
+
</Space>
|
|
32
|
+
</div>
|
|
33
|
+
</Drawer>
|
|
34
|
+
</template>
|
|
35
|
+
<script lang="ts" setup>
|
|
36
|
+
import { Button, Card, Drawer, Divider, Space } from 'ant-design-vue'
|
|
37
|
+
import { ref } from 'vue'
|
|
38
|
+
import ActionEdit from './actionEdit.vue'
|
|
39
|
+
import ConditionEdit from './conditionEdit.vue'
|
|
40
|
+
import { LogicRuleItem } from './types'
|
|
41
|
+
const emit = defineEmits(['ok'])
|
|
42
|
+
|
|
43
|
+
const open = ref<boolean>(false);
|
|
44
|
+
const logicRules = ref<LogicRuleItem[]>([])
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
function showDrawer(rules: LogicRuleItem[] = []) {
|
|
48
|
+
logicRules.value = rules
|
|
49
|
+
open.value = true
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function handleAdd() {
|
|
53
|
+
logicRules.value.push({
|
|
54
|
+
actions: [],
|
|
55
|
+
condition: {
|
|
56
|
+
conditions: [],
|
|
57
|
+
operator: 'and'
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
function handleDelete(index) {
|
|
64
|
+
logicRules.value.splice(index, 1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function handleClose() {
|
|
68
|
+
open.value = false
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function handleOk() {
|
|
72
|
+
emit('ok', logicRules.value)
|
|
73
|
+
handleClose()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
defineExpose({ showDrawer })
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
<style lang="less">
|
|
83
|
+
.epic-drawer-form-logic {
|
|
84
|
+
|
|
85
|
+
// 覆盖iconfont样式
|
|
86
|
+
.iconfont {
|
|
87
|
+
font-family: "epic-iconfont", "iconfont" !important;
|
|
88
|
+
font-style: normal;
|
|
89
|
+
font-size: 1em;
|
|
90
|
+
-webkit-font-smoothing: antialiased;
|
|
91
|
+
-moz-osx-font-smoothing: grayscale;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ant-drawer-body {
|
|
95
|
+
padding: 16px 0 24px;
|
|
96
|
+
|
|
97
|
+
.epic-drawer-container {
|
|
98
|
+
padding-bottom: 30px;
|
|
99
|
+
|
|
100
|
+
&>div {
|
|
101
|
+
padding: 0 16px;
|
|
102
|
+
border-bottom: 1px solid var(--epic-border-color);
|
|
103
|
+
|
|
104
|
+
&::-webkit-scrollbar {
|
|
105
|
+
width: 8px;
|
|
106
|
+
height: 8px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&::-webkit-scrollbar-thumb {
|
|
110
|
+
background: #0000002d;
|
|
111
|
+
border-radius: 6px;
|
|
112
|
+
-webkit-box-shadow: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&::-webkit-scrollbar-track {
|
|
116
|
+
background: transparent;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<Badge :count="props.modelValue?.length ?? 0">
|
|
4
|
+
<Button @click="handleShowDrawer">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<span class="iconfont epic-icon-shezhi mr-1" />
|
|
7
|
+
</template>
|
|
8
|
+
配置</Button>
|
|
9
|
+
</Badge>
|
|
10
|
+
<Drawer @ok="handleOk" ref="drawerRef" />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { ref } from 'vue'
|
|
15
|
+
import { LogicRuleItem } from './types'
|
|
16
|
+
import { Button, Badge } from 'ant-design-vue'
|
|
17
|
+
import Drawer from './drawer.vue'
|
|
18
|
+
const props = defineProps<{
|
|
19
|
+
modelValue?: LogicRuleItem[]
|
|
20
|
+
}>()
|
|
21
|
+
|
|
22
|
+
const drawerRef = ref<InstanceType<typeof Drawer>>()
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits(['update:modelValue'])
|
|
25
|
+
|
|
26
|
+
function handleShowDrawer() {
|
|
27
|
+
drawerRef.value?.showDrawer(props.modelValue)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function handleOk(e) {
|
|
31
|
+
emit('update:modelValue', e)
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ConditionItem {
|
|
2
|
+
field?: string;
|
|
3
|
+
operator?: string;
|
|
4
|
+
value?: any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface Condition {
|
|
8
|
+
conditions: ConditionItem[];
|
|
9
|
+
operator: 'or' | 'and';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ActionItem {
|
|
13
|
+
field?: string;
|
|
14
|
+
trigger?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export interface LogicRuleItem {
|
|
21
|
+
actions: ActionItem[];
|
|
22
|
+
condition: Condition;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type LogicRules = LogicRuleItem[]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.epic-designer-main {
|
|
2
|
+
.ant-input-number {
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ant-collapse-content > .ant-collapse-content-box {
|
|
7
|
+
padding: 8px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ant-select {
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.epic-upload-image {
|
|
15
|
+
.avatar-uploader > .ant-upload {
|
|
16
|
+
width: 128px;
|
|
17
|
+
height: 128px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 适配k-input-size样式
|
|
23
|
+
.epic-input-size {
|
|
24
|
+
&.ant-input-affix-wrapper {
|
|
25
|
+
padding-top: 0;
|
|
26
|
+
padding-right: 0;
|
|
27
|
+
padding-bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
.ant-select:hover {
|
|
30
|
+
border: none !important;
|
|
31
|
+
box-shadow: none !important;
|
|
32
|
+
}
|
|
33
|
+
}
|