zhuoyuan.wang
2024-06-19 15ebe96f28cadec6a726c5324593a40bbf56205f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!--
 * @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>