vue2-client 1.16.45 → 1.16.47

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="x-title-container">
2
+ <div class="x-title-container" :class="wrapperClassObject">
3
3
  <div
4
4
  v-if="config.type === 'title'"
5
5
  class="x-title"
@@ -18,7 +18,7 @@
18
18
  </template>
19
19
 
20
20
  <script setup>
21
- import { ref, computed, onMounted } from 'vue'
21
+ import { ref, computed, onMounted, useAttrs } from 'vue'
22
22
 
23
23
  const props = defineProps({
24
24
  queryParamsName: {
@@ -50,6 +50,21 @@ const lineStyle = computed(() => {
50
50
  return style
51
51
  })
52
52
 
53
+ // 动态样式开关:通过 $attrs 生成 xtitle-* 类(布尔开关 + size 派生类)
54
+ const attrs = useAttrs()
55
+ const wrapperClassObject = computed(() => {
56
+ const classes = {}
57
+ const booleanStyleKeys = [
58
+ 'center', 'littlefont'
59
+ ]
60
+ booleanStyleKeys.forEach(key => {
61
+ const val = attrs[key]
62
+ const truthy = val === true || val === '' || val === 'true'
63
+ if (truthy) classes[`x-title-${key}`] = true
64
+ })
65
+ return classes
66
+ })
67
+
53
68
  const handleClick = () => {
54
69
  if (config.value.clickName) {
55
70
  emit(config.value.clickName)
@@ -90,7 +105,7 @@ onMounted(() => {
90
105
  })
91
106
  </script>
92
107
 
93
- <style scoped>
108
+ <style scoped lang="less">
94
109
  .x-title-container {
95
110
  display: flex;
96
111
  align-items: center;
@@ -99,12 +114,12 @@ onMounted(() => {
99
114
 
100
115
  .x-title {
101
116
  font-size: 18px;
102
- font-weight: bold;
117
+ font-weight: 700;
103
118
  height: 26px;
104
119
  width: 100%;
105
120
  text-align: left;
106
- font-family: "Source Han Sans", sans-serif;
107
- color: #5D5C5C;
121
+ font-family: "Source Han Sans";
122
+ color: #313131;
108
123
  position: relative;
109
124
  }
110
125
 
@@ -120,4 +135,20 @@ onMounted(() => {
120
135
  .x-button-container {
121
136
  text-align: right;
122
137
  }
138
+ .x-title-center {
139
+ &.x-title-container,
140
+ .x-title-container {
141
+ :deep(.x-title) {
142
+ text-align: center;
143
+ }
144
+ }
145
+ }
146
+ .x-title-littlefont {
147
+ &.x-title-container,
148
+ .x-title-container {
149
+ :deep(.x-title) {
150
+ font-size: 16px;
151
+ }
152
+ }
153
+ }
123
154
  </style>
@@ -1,113 +1,113 @@
1
- <template>
2
- <!-- 根据实际部署环境修改 editor.html 的路径 -->
3
- <iframe
4
- src="/his/editor/editor.html"
5
- width="100%"
6
- height="800"
7
- frameborder="0"
8
- @load="onIframeLoad"
9
- ref="editorIframe">
10
- </iframe>
11
- </template>
12
-
13
- <script setup>
14
-
15
- import { ref, onBeforeUnmount } from 'vue'
16
-
17
- const editorIframe = ref(null)
18
- const checkEditorTimer = ref(null)
19
- const checkCount = ref(0)
20
- const editor = ref(null)
21
- const iframeWindow = ref(null)
22
- // 对外暴露的获取editor方法
23
- const getEditor = () => {
24
- if (editor.value) {
25
- return editor.value
26
- }
27
- if (iframeWindow.value && iframeWindow.value.editor) {
28
- editor.value = iframeWindow.value.editor
29
- return editor.value
30
- }
31
- if (editorIframe.value && editorIframe.value.contentWindow && editorIframe.value.contentWindow.editor) {
32
- editor.value = editorIframe.value.contentWindow.editor
33
- return editor.value
34
- }
35
- return null
36
- }
37
- // 创建体温单方法
38
- const createVitalSigns = (data) => {
39
- const editorObj = getEditor()
40
- if (!editorObj) {
41
- throw new Error('editor对象未初始化,无法创建体温单')
42
- }
43
- if (typeof editorObj.createVitalSigns === 'function') {
44
- return editorObj.createVitalSigns(data)
45
- } else {
46
- throw new Error('editor对象未包含createVitalSigns方法')
47
- }
48
- }
49
-
50
- // 检查editor对象是否已初始化
51
- const startEditorCheck = (frameWindow, iframe) => {
52
- if (checkEditorTimer.value) {
53
- clearInterval(checkEditorTimer.value)
54
- }
55
- checkCount.value = 0
56
- checkEditorTimer.value = setInterval(() => {
57
- checkCount.value++
58
- try {
59
- const editorObj = frameWindow.editor
60
- if (editorObj && typeof editorObj.createVitalSigns === 'function') {
61
- clearInterval(checkEditorTimer.value)
62
- editor.value = editorObj
63
- // 将editor对象暴露到全局
64
- window.iframeEditor = editorObj
65
- window.iframeWindow = frameWindow
66
- // 触发事件
67
- emit('editor-ready', editorObj)
68
- emit('load', { target: iframe, editor: editorObj })
69
- // 发送消息通知
70
- window.parent.postMessage({ type: 'editorReady' }, '*')
71
- }
72
- } catch (err) {
73
- console.error('检查editor对象时出错:', err)
74
- }
75
- if (checkCount.value >= 20) {
76
- clearInterval(checkEditorTimer.value)
77
- console.error('Editor 对象加载失败')
78
- }
79
- }, 500)
80
- }
81
- // iframe加载完成的处理
82
- const onIframeLoad = (e) => {
83
- const iframe = e.target
84
- const frameWindow = iframe.contentWindow
85
- iframeWindow.value = frameWindow
86
- if (!frameWindow) {
87
- console.error('无法访问 iframe 内容')
88
- return
89
- }
90
- // 关闭文书工具栏
91
- iframe.contentWindow.editor.option.toolbar = false
92
- startEditorCheck(frameWindow, iframe)
93
- }
94
- // 组件销毁前清理
95
- onBeforeUnmount(() => {
96
- if (checkEditorTimer.value) {
97
- clearInterval(checkEditorTimer.value)
98
- }
99
- })
100
- // 暴露方法给父组件
101
- defineExpose({ getEditor, createVitalSigns })
102
-
103
- // 定义事件
104
- const emit = defineEmits(['editor-ready', 'load'])
105
- </script>
106
-
107
- <style scoped>
108
- iframe {
109
- border: none;
110
- width: 100%;
111
- min-height: 800px;
112
- }
113
- </style>
1
+ <template>
2
+ <!-- 根据实际部署环境修改 editor.html 的路径 -->
3
+ <iframe
4
+ src="/his/editor/editor.html"
5
+ width="100%"
6
+ height="800"
7
+ frameborder="0"
8
+ @load="onIframeLoad"
9
+ ref="editorIframe">
10
+ </iframe>
11
+ </template>
12
+
13
+ <script setup>
14
+
15
+ import { ref, onBeforeUnmount } from 'vue'
16
+
17
+ const editorIframe = ref(null)
18
+ const checkEditorTimer = ref(null)
19
+ const checkCount = ref(0)
20
+ const editor = ref(null)
21
+ const iframeWindow = ref(null)
22
+ // 对外暴露的获取editor方法
23
+ const getEditor = () => {
24
+ if (editor.value) {
25
+ return editor.value
26
+ }
27
+ if (iframeWindow.value && iframeWindow.value.editor) {
28
+ editor.value = iframeWindow.value.editor
29
+ return editor.value
30
+ }
31
+ if (editorIframe.value && editorIframe.value.contentWindow && editorIframe.value.contentWindow.editor) {
32
+ editor.value = editorIframe.value.contentWindow.editor
33
+ return editor.value
34
+ }
35
+ return null
36
+ }
37
+ // 创建体温单方法
38
+ const createVitalSigns = (data) => {
39
+ const editorObj = getEditor()
40
+ if (!editorObj) {
41
+ throw new Error('editor对象未初始化,无法创建体温单')
42
+ }
43
+ if (typeof editorObj.createVitalSigns === 'function') {
44
+ return editorObj.createVitalSigns(data)
45
+ } else {
46
+ throw new Error('editor对象未包含createVitalSigns方法')
47
+ }
48
+ }
49
+
50
+ // 检查editor对象是否已初始化
51
+ const startEditorCheck = (frameWindow, iframe) => {
52
+ if (checkEditorTimer.value) {
53
+ clearInterval(checkEditorTimer.value)
54
+ }
55
+ checkCount.value = 0
56
+ checkEditorTimer.value = setInterval(() => {
57
+ checkCount.value++
58
+ try {
59
+ const editorObj = frameWindow.editor
60
+ if (editorObj && typeof editorObj.createVitalSigns === 'function') {
61
+ clearInterval(checkEditorTimer.value)
62
+ editor.value = editorObj
63
+ // 将editor对象暴露到全局
64
+ window.iframeEditor = editorObj
65
+ window.iframeWindow = frameWindow
66
+ // 触发事件
67
+ emit('editor-ready', editorObj)
68
+ emit('load', { target: iframe, editor: editorObj })
69
+ // 发送消息通知
70
+ window.parent.postMessage({ type: 'editorReady' }, '*')
71
+ }
72
+ } catch (err) {
73
+ console.error('检查editor对象时出错:', err)
74
+ }
75
+ if (checkCount.value >= 20) {
76
+ clearInterval(checkEditorTimer.value)
77
+ console.error('Editor 对象加载失败')
78
+ }
79
+ }, 500)
80
+ }
81
+ // iframe加载完成的处理
82
+ const onIframeLoad = (e) => {
83
+ const iframe = e.target
84
+ const frameWindow = iframe.contentWindow
85
+ iframeWindow.value = frameWindow
86
+ if (!frameWindow) {
87
+ console.error('无法访问 iframe 内容')
88
+ return
89
+ }
90
+ // 关闭文书工具栏
91
+ iframe.contentWindow.editor.option.toolbar = false
92
+ startEditorCheck(frameWindow, iframe)
93
+ }
94
+ // 组件销毁前清理
95
+ onBeforeUnmount(() => {
96
+ if (checkEditorTimer.value) {
97
+ clearInterval(checkEditorTimer.value)
98
+ }
99
+ })
100
+ // 暴露方法给父组件
101
+ defineExpose({ getEditor, createVitalSigns })
102
+
103
+ // 定义事件
104
+ const emit = defineEmits(['editor-ready', 'load'])
105
+ </script>
106
+
107
+ <style scoped>
108
+ iframe {
109
+ border: none;
110
+ width: 100%;
111
+ min-height: 800px;
112
+ }
113
+ </style>