-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
v_huyilin
committed
Dec 4, 2024
1 parent
ac50451
commit 4b76293
Showing
7 changed files
with
365 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 52 additions & 3 deletions
55
packages/form-design/Right/AttrEdit/LinkageConfig/Config.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,64 @@ | ||
<template> | ||
<el-dialog destroy-on-close v-model="visible" top="3vh" title="配置级联动" width="70vw"> | ||
<FormRender v-model="designInstance.current!" :schema="configSchema" /> | ||
<el-dialog | ||
destroy-on-close | ||
v-model="visible" | ||
top="3vh" | ||
:title="`${designInstance.current?.label} - 配置级联动`" | ||
width="70vw" | ||
center | ||
> | ||
<div class="config-linkages"> | ||
<div class="quick"> | ||
<FormRender v-model="quickValues" :schema="quickSchema(designInstance.schema)" /> | ||
<el-button | ||
v-if="quickValues.quick?.length" | ||
@click="handleUseQuick" | ||
style="margin-bottom: 20px" | ||
type="primary" | ||
>应用快速配置</el-button | ||
> | ||
</div> | ||
<FormRender v-model="designInstance.current!" :schema="editSchema" class="edit" /> | ||
</div> | ||
</el-dialog> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import FormRender from '@vue-form-craft/form-render' | ||
import configSchema from './configSchema' | ||
import { quickSchema, editSchema } from './configSchema' | ||
import { useDesignInstance } from '@vue-form-craft/hooks' | ||
import { ref } from 'vue' | ||
import { setDataByPath } from '@vue-form-craft/utils' | ||
const designInstance = useDesignInstance() | ||
const visible = defineModel<boolean>() | ||
const quickValues = ref<Record<string, any>>({}) | ||
const handleUseQuick = () => { | ||
console.log(quickValues.value.quick); | ||
quickValues.value.quick.map((item) => { | ||
const { name, type, variable } = item | ||
if (type === 'var') { | ||
const newCurrent = setDataByPath(designInstance.current!, name, `{{ ${variable.slice(1).join('.')} }}`) | ||
designInstance.updateCurrent(newCurrent) | ||
} | ||
}) | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.config-linkages{ | ||
display: flex; | ||
gap: 20px; | ||
.quick{ | ||
width: 50%; | ||
} | ||
.edit{ | ||
width: 50%; | ||
} | ||
} | ||
</style> |
Oops, something went wrong.