vue2-client 1.16.41 → 1.16.44

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-radio-container">
2
+ <div class="x-radio-container" :class="wrapperClassObject()">
3
3
  <a-radio-group v-model="innerValue" @change="onChange" class="x-radio-group">
4
4
  <div v-for="item in data" :key="item.value" class="x-radio-item-container">
5
5
  <a-radio :value="item.value" class="x-radio-item">
@@ -87,12 +87,25 @@ export default {
87
87
  onChange (e) {
88
88
  this.innerValue = e.target.value
89
89
  this.$emit('change', e.target.value)
90
- }
90
+ },
91
+ wrapperClassObject () {
92
+ const attrs = this.$attrs || {}
93
+ const classes = {}
94
+ const booleanStyleKeys = [
95
+ 'item-0padding'
96
+ ]
97
+ booleanStyleKeys.forEach(key => {
98
+ const val = attrs[key]
99
+ const truthy = val === true || val === '' || val === 'true'
100
+ if (truthy) classes[`x-radio-${key}`] = true
101
+ })
102
+ return classes
103
+ },
91
104
  }
92
105
  }
93
106
  </script>
94
107
 
95
- <style scoped>
108
+ <style scoped lang="less">
96
109
  .x-radio-container {
97
110
  display: flex;
98
111
  flex-direction: column;
@@ -122,4 +135,16 @@ export default {
122
135
  transition: all 0.3s;
123
136
  max-width: 100%;
124
137
  }
138
+ .x-radio-description {
139
+ padding: 4px 4px 4px 4px;
140
+ }
141
+
142
+ .x-radio-item-0padding {
143
+ &.x-radio-container,
144
+ .x-radio-container {
145
+ :deep(.x-radio-item-container) {
146
+ padding: 0px;
147
+ }
148
+ }
149
+ }
125
150
  </style>
@@ -4,6 +4,7 @@
4
4
  v-model="selectedValue"
5
5
  :placeholder="placeholder"
6
6
  class="x-select"
7
+ :class="wrapperClassObject()"
7
8
  :allowClear="true"
8
9
  :showSearch="true"
9
10
  :filter-option="filterOption"
@@ -56,7 +57,20 @@ export default {
56
57
  },
57
58
  filterOption (input, option) {
58
59
  return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
59
- }
60
+ },
61
+ wrapperClassObject () {
62
+ const attrs = this.$attrs || {}
63
+ const classes = {}
64
+ const booleanStyleKeys = [
65
+ 'x-select4'
66
+ ]
67
+ booleanStyleKeys.forEach(key => {
68
+ const val = attrs[key]
69
+ const truthy = val === true || val === '' || val === 'true'
70
+ if (truthy) classes[`x-select-${key}`] = true
71
+ })
72
+ return classes
73
+ },
60
74
  },
61
75
  watch: {
62
76
  selectedValue (val) {
@@ -65,8 +79,13 @@ export default {
65
79
  }
66
80
  </script>
67
81
 
68
- <style scoped>
82
+ <style scoped lang="less">
69
83
  .x-select {
70
84
  min-width: 150px;
71
85
  }
86
+
87
+ .x-select-x-select4 {
88
+ width: 100%;
89
+ min-width: auto;
90
+ }
72
91
  </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>