<!--
|
* @Description: 公式规则-编辑弹窗
|
-->
|
|
<template>
|
<app-dialog-form
|
v-bind="dialogFormProps"
|
>
|
<app-tinymce-formula v-bind="tinymceFormulaProps"/>
|
</app-dialog-form>
|
<radio-properties-dialog v-bind="radioPropertiesDialogProps"/>
|
</template>
|
|
<script setup>
|
|
import RadioPropertiesDialog from './RadioPropertiesDialog';
|
|
import {useEntityStore} from "@/store/modules";
|
|
const entityStore = useEntityStore();
|
|
const props = defineProps({
|
subSubmit: {
|
type: Function,
|
default: () => {
|
}
|
},
|
options: {
|
type: Object,
|
default: {}
|
}
|
});
|
|
const tinymceFormulaRef = ref();
|
|
const dialogFormRef = ref();
|
|
const tinymceFormulaProps = {
|
ref: tinymceFormulaRef,
|
operatorGroup: 'rule',
|
subProperties() {
|
radioPropertiesDialogRef.value.onOpen();
|
}
|
};
|
|
const dialogFormProps = {
|
width: 1000,
|
title: "新增",
|
ref: dialogFormRef,
|
subSubmit: async () => {
|
props.subSubmit(tinymceFormulaRef.value.getContext());
|
},
|
subReset: async () => {
|
tinymceFormulaRef.value.setContext(form.targetValue);
|
}
|
};
|
|
const radioPropertiesDialogRef = ref();
|
|
const radioPropertiesDialogProps = {
|
options: props.options,
|
ref: radioPropertiesDialogRef,
|
subSubmit: (current) => {
|
tinymceFormulaRef.value.setField({
|
name: current[props.options.property.name],
|
code: current[props.options.property.value]
|
});
|
}
|
}
|
|
const form = {
|
targetValue: ''
|
}
|
|
/**
|
* @description: 打开公式编辑弹窗
|
* @return {*}
|
*/
|
const onOpen = async (text) => {
|
form.targetValue = text;
|
dialogFormRef.value.onOpen();
|
|
await nextTick();
|
|
tinymceFormulaRef.value.setContext(text);
|
|
};
|
|
defineExpose({
|
onOpen
|
});
|
|
</script>
|
<style lang="scss" scoped>
|
.main {
|
h6 {
|
font-size: 14px;
|
line-height: 14px;
|
display: block;
|
margin: 0 0 12px 0;
|
}
|
|
.left {
|
border-right: 1px solid #ccc;
|
padding: 10px;
|
|
.row {
|
max-height: 400px;
|
overflow-y: auto;
|
flex-wrap: nowrap;
|
}
|
|
.tools {
|
margin-top: 10px;
|
}
|
}
|
|
.row {
|
display: flex;
|
flex-direction: column;
|
padding: 12px;
|
|
.content {
|
display: flex;
|
flex-wrap: wrap;
|
|
.item {
|
flex: 0 0 calc((100% - 10px) / 7);
|
margin: 0 8px 8px 0;
|
}
|
}
|
}
|
}
|
</style>
|