Merge remote-tracking branch 'origin/dev' into feature/vue3-bpm

This commit is contained in:
YunaiV 2023-01-19 16:50:07 +08:00
commit 62a86fdff1

View File

@ -16,13 +16,24 @@
</el-col> </el-col>
</el-row> </el-row>
<Dialog :title="dialogTitle" v-model="dialogVisible" maxHeight="600"> <Dialog :title="dialogTitle" v-model="dialogVisible" maxHeight="600">
<div ref="editor" v-if="dialogVisible">{{ formValue }}</div> <div ref="editor" v-if="dialogVisible">
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(formValue)" />
<el-scrollbar height="580">
<pre>
{{ formValue }}
</pre>
</el-scrollbar>
</div>
<span style="color: red" v-if="err">输入内容格式有误!</span> <span style="color: red" v-if="err">输入内容格式有误!</span>
</Dialog> </Dialog>
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="Build"> <script setup lang="ts" name="Build">
import formCreate from '@form-create/element-ui' import formCreate from '@form-create/element-ui'
import { useClipboard } from '@vueuse/core'
const { t } = useI18n()
const message = useMessage()
const designer = ref() const designer = ref()
@ -38,10 +49,10 @@ const openModel = (title: string) => {
} }
const setJson = () => { const setJson = () => {
openModel('导入JSON') openModel('导入JSON--未实现')
} }
const setOption = () => { const setOption = () => {
openModel('导入Options') openModel('导入Options--未实现')
} }
const showJson = () => { const showJson = () => {
openModel('生成JSON') openModel('生成JSON')
@ -61,6 +72,20 @@ const showTemplate = () => {
const changeLocale = () => { const changeLocale = () => {
console.info('changeLocale') console.info('changeLocale')
} }
/** 复制 **/
const copy = async (text: string) => {
const { copy, copied, isSupported } = useClipboard({ source: text })
if (!isSupported) {
message.error(t('common.copyError'))
} else {
await copy()
if (unref(copied)) {
message.success(t('common.copySuccess'))
}
}
}
const makeTemplate = () => { const makeTemplate = () => {
const rule = designer.value.getRule() const rule = designer.value.getRule()
const opt = designer.value.getOption() const opt = designer.value.getOption()
@ -75,11 +100,16 @@ const makeTemplate = () => {
<script setup lang=ts> <script setup lang=ts>
import formCreate from "@form-create/element-ui"; import formCreate from "@form-create/element-ui";
const faps = ref(null) const faps = ref(null)
const rule = formCreate.parseJson('${formCreate.toJson(rule).replaceAll('\\', '\\\\')}') const rule = ref('')
const option = formCreate.parseJson('${JSON.stringify(opt)}') const option = ref('')
const init = () => {
rule.value = formCreate.parseJson('${formCreate.toJson(rule).replaceAll('\\', '\\\\')}')
option.value = formCreate.parseJson('${JSON.stringify(opt)}')
}
const onSubmit = (formData) => { const onSubmit = (formData) => {
//todo //todo
} }
init()
<\/script>` <\/script>`
} }
</script> </script>