vue2-client 1.9.89 → 1.9.91

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.9.89",
3
+ "version": "1.9.91",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -24,8 +24,8 @@
24
24
  style="flex: 1; width: auto; min-width: 0;"
25
25
  @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
26
26
  :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
27
- @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
28
- @keyup.enter="attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
27
+ @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
28
+ @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
29
29
  :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
30
30
  :ref="`${attr.model}input`"/>
31
31
  <a-button
@@ -57,8 +57,8 @@
57
57
  :whitespace="true"
58
58
  :disabled="disabled && !readOnly"
59
59
  style="width:100%"
60
- @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
61
- @keyup.enter="attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
60
+ @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
61
+ @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
62
62
  :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
63
63
  :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
64
64
  :ref="`${attr.model}input`"/>
@@ -70,11 +70,10 @@
70
70
  :disabled="disabled && !readOnly"
71
71
  :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
72
72
  style="width:100%"
73
- @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
74
- @keyup.enter="attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
73
+ @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
74
+ @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
75
75
  :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
76
76
  :ref="`${attr.model}input`"/>
77
-
78
77
  </a-form-model-item>
79
78
  </x-form-col>
80
79
  <!-- 下拉框 -->
@@ -52,6 +52,9 @@ export default {
52
52
  },
53
53
  selectType (value) {
54
54
  this.selectedType = value
55
+ if (this.selectedType) { // 检查选中内容是否不为空
56
+ this.$emit('selected', this.selectedType) // 发送选中事件
57
+ }
55
58
  },
56
59
  updateUnderline () {
57
60
  // 动态更新下划线位置和宽度
@@ -182,6 +182,11 @@ export default {
182
182
  type: Array,
183
183
  default: undefined
184
184
  },
185
+ // 是否小插件模式,小插件模式不会有各种边境
186
+ isWidget: {
187
+ type: Boolean,
188
+ default: false
189
+ },
185
190
  // 图片是否使用OSS来保存
186
191
  useOssForImg: {
187
192
  type: Boolean,
@@ -264,6 +269,7 @@ export default {
264
269
  getComponentByName: this.getComponentByName,
265
270
  getParentComponentByName: this.getComponentByName,
266
271
  getConfigByName: getConfigByName,
272
+ isWidget: this.widget,
267
273
  currUser: this.currUser
268
274
  }
269
275
  },
@@ -1011,7 +1017,10 @@ export default {
1011
1017
  }
1012
1018
  },
1013
1019
  computed: {
1014
- ...mapState('account', { currUser: 'user' })
1020
+ ...mapState('account', { currUser: 'user' }),
1021
+ widget () {
1022
+ return this.isWidget // 返回isWidget的值
1023
+ }
1015
1024
  },
1016
1025
  mounted () {
1017
1026
  // 如果外界传来了registerMap,我们将本VM对象注册到map中
@@ -31,8 +31,8 @@ export default {
31
31
  },
32
32
  data () {
33
33
  return {
34
- configName: 'medicalRecordCover'
35
- // configName: 'physicianOrderEntryCover'
34
+ // configName: 'medicalRecordCover'
35
+ configName: 'physicianOrderEntryCover'
36
36
  }
37
37
  },
38
38
  methods: {
@@ -12,6 +12,64 @@
12
12
  :no-top-border="noTopBorder"
13
13
  :config="activatedConfig"/>
14
14
  </template>
15
+ <template v-else-if="isWidget">
16
+ <template v-for="(row, rowIndex) in activatedConfig.columns">
17
+ <!-- 插槽展示 -->
18
+ <template v-if="row[0].type === 'slot'">
19
+ <x-report-tr-group
20
+ @updateImg="updateImg"
21
+ @selectRow="selectRow"
22
+ :show-img-in-cell="showImgInCell"
23
+ :img-prefix="imgPrefix"
24
+ :server-name="serverName"
25
+ :env="env"
26
+ :use-oss-for-img="useOssForImg"
27
+ :key="rowIndex"
28
+ :columns="row"
29
+ :no-top-border="noTopBorder"
30
+ :config-data="activatedConfig.data"
31
+ :config="activatedConfig"
32
+ :display="true">
33
+ </x-report-tr-group>
34
+ </template>
35
+ <!-- 普通行 -->
36
+ <template v-else>
37
+ <template v-if="!forDisplay">
38
+ <x-report-tr-group
39
+ @updateImg="updateImg"
40
+ @selectRow="selectRow"
41
+ :show-img-in-cell="showImgInCell"
42
+ :img-prefix="imgPrefix"
43
+ :server-name="serverName"
44
+ :env="env"
45
+ :use-oss-for-img="useOssForImg"
46
+ :key="rowIndex"
47
+ :columns="row"
48
+ :no-top-border="noTopBorder"
49
+ :config-data="activatedConfig.data"
50
+ :config="activatedConfig">
51
+ </x-report-tr-group>
52
+ </template>
53
+ <template v-else>
54
+ <x-report-tr-group
55
+ @updateImg="updateImg"
56
+ @selectRow="selectRow"
57
+ :show-img-in-cell="showImgInCell"
58
+ :img-prefix="imgPrefix"
59
+ :server-name="serverName"
60
+ :env="env"
61
+ :use-oss-for-img="useOssForImg"
62
+ :config="activatedConfig"
63
+ :key="rowIndex"
64
+ :columns="row"
65
+ :no-top-border="noTopBorder"
66
+ :config-data="activatedConfig.data"
67
+ :display="true">
68
+ </x-report-tr-group>
69
+ </template>
70
+ </template>
71
+ </template>
72
+ </template>
15
73
  <template v-else>
16
74
  <div :class=" noPadding ? 'reportMainNoPadding' : 'reportMain'" :style="activatedConfig.width > 0 ? ('width:' + activatedConfig.width + 'px') : undefined">
17
75
  <!-- 大标题 -->
@@ -298,6 +356,7 @@ export default {
298
356
  XReportTrGroup,
299
357
  XReportJsonRender
300
358
  },
359
+ inject: ['isWidget'],
301
360
  data () {
302
361
  return {
303
362
  // 表单的数据
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <a-row type="flex" :gutter="gutter" style="margin-bottom: .5rem;">
2
+ <a-row id="has_row" type="flex" :gutter="gutter" :style="isWidget ? {margin: '0px'} : {'margin-bottom': '.5rem'}">
3
3
  <!-- 预览页展示 -->
4
4
  <template v-if="display">
5
5
  <template v-if="!inputColumns">
@@ -8,9 +8,49 @@
8
8
  v-for="(cell, cellIndex) in columns"
9
9
  v-if="Array.isArray(cell) || !cell.dontShowRow"
10
10
  :key="cellIndex"
11
- :style="Array.isArray(cell) ? {} : determineCellStyle(cell)"
11
+ :style="isWidget ? {padding: '0px 2px'} : (Array.isArray(cell) ? {} : determineCellStyle(cell))"
12
12
  :span="Array.isArray(cell) ? cell[0][0].colSpan * 2 : (cell.colSpan ? cell.colSpan * 2 : undefined)">
13
- <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
13
+ <div id="report_widget" v-if="isWidget">
14
+ <!-- 插槽渲染 -->
15
+ <template v-if="Array.isArray(cell)">
16
+ <!-- 处理 cell 是数组的情况 -->
17
+ <div v-for="(item, index) in cell" :key="index">
18
+ <x-report-tr-group
19
+ @updateImg="updateImg"
20
+ :show-img-in-cell="showImgInCell"
21
+ :img-prefix="imgPrefix"
22
+ :server-name="serverName"
23
+ :env="env"
24
+ :use-oss-for-img="useOssForImg"
25
+ :key="index"
26
+ :columns="recalculateItem(item)"
27
+ :no-top-border="noTopBorder"
28
+ :config-data="configData"
29
+ :config="config"
30
+ :display="true">
31
+ </x-report-tr-group>
32
+ </div>
33
+ </template>
34
+ <template v-else-if="cell.type === 'slot'">
35
+ <template
36
+ v-if="['x-form-table','x-add-native-form','x-tree-pro', 'x-his-editor', 'x-tab', 'x-form-group', 'x-report', 'x-buttons', 'x-label-select', 'x-conversation'].includes(cell.slotType)">
37
+ <component
38
+ :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
39
+ :key="cellIndex"
40
+ :ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
41
+ :serviceName="cell.serviceName"
42
+ :serverName="cell.serviceName"
43
+ v-on="getEventHandlers(cell)"
44
+ @hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
45
+ :queryParamsName="cell.slotConfig"
46
+ :configName="cell.slotConfig"
47
+ :countVisible="false"
48
+ :env="env"
49
+ />
50
+ </template>
51
+ </template>
52
+ </div>
53
+ <a-card v-else class="flexItem" :bordered="false" :body-style="flexItemBodyState">
14
54
  <!-- 插槽渲染 -->
15
55
  <template v-if="Array.isArray(cell)">
16
56
  <!-- 处理 cell 是数组的情况 -->
@@ -525,7 +565,7 @@ export default {
525
565
  // tableConfig: {}
526
566
  }
527
567
  },
528
- inject: ['openDialog', 'registerComponent', 'getComponentByName', 'runLogic', 'getMixinData', 'getSelectedId', 'isInAModal', 'getConfigByName', 'getSelectedData', 'getOutEnv', 'currUser'],
568
+ inject: ['openDialog', 'registerComponent', 'getComponentByName', 'runLogic', 'getMixinData', 'getSelectedId', 'isInAModal', 'getConfigByName', 'getSelectedData', 'getOutEnv', 'currUser', 'isWidget'],
529
569
  methods: {
530
570
  getWindow,
531
571
  isMicroAppEnv,
@@ -733,29 +773,6 @@ export default {
733
773
  if (this.config.style.borderColor) {
734
774
  color = this.config.style.borderColor
735
775
  }
736
- // // 如果声明了borderWidth
737
- // if (this.config.style.borderWidth) {
738
- // borderWidth = this.config.style.borderWidth
739
- // }
740
- // // 普通带边框单元格
741
- // const withBorder = {
742
- // border: borderWidth + ' solid ' + color,
743
- // padding: '8px'
744
- // }
745
- // // 只有左右边框的单元格
746
- // const noBorder = {
747
- // borderLeft: borderWidth + ' solid ' + color,
748
- // borderRight: borderWidth + ' solid ' + color,
749
- // padding: '8px'
750
- // }
751
- // // 只没有上边框的单元格
752
- // const NoTopBorder = {
753
- // borderTopStyle: 'none',
754
- // borderLeft: borderWidth + ' solid ' + color,
755
- // borderRight: borderWidth + ' solid ' + color,
756
- // borderBottom: borderWidth + ' solid ' + color,
757
- // padding: '8px'
758
- // }
759
776
  let result = {}
760
777
  // 如果表格也声明了样式,用表格样式将样式覆盖
761
778
  if (cell.style) {
@@ -772,6 +789,7 @@ export default {
772
789
  }
773
790
  return result
774
791
  },
792
+
775
793
  // 表格中数据key含有@@@,需要手动触发更新
776
794
  handleInputDeepChange () {
777
795
  this.$forceUpdate()
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div v-show="tableColumns.length > 0">
3
3
  <a-row :gutter="48">
4
- <a-col v-show="showLeftOperaBtn" :span="8">
4
+ <a-col v-show="showLeftOperaBtn">
5
5
  <span :style="{ float: 'left', overflow: 'hidden', marginBottom: '8px' }">
6
6
  <a-space>
7
7
  <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
@@ -11,7 +11,11 @@
11
11
  <a-button v-if="buttonState.move && buttonRendering('move')" type="primary" @click="move">
12
12
  <a-icon type="plus"/>添加
13
13
  </a-button>
14
- <a-button v-if="buttonState.choose && buttonRendering('choose')" :disabled="!isChoose" type="primary" @click="choose">
14
+ <a-button
15
+ v-if="buttonState.choose && buttonRendering('choose')"
16
+ :disabled="!isChoose"
17
+ type="primary"
18
+ @click="choose">
15
19
  <a-icon type="check-square"/>选择
16
20
  </a-button>
17
21
  <a-button
@@ -72,28 +76,31 @@
72
76
  <a-icon type="dashed" :style="iconStyle"/>
73
77
  {{ button.buttonName }}
74
78
  </a-button>
75
- <a-button v-if="allowedCardMode && !simpleMode" @click="changeViewMode" :type="isTableMode ? '' : 'primary'">
79
+ <a-button
80
+ v-if="allowedCardMode && !simpleMode"
81
+ @click="changeViewMode"
82
+ :type="isTableMode ? '' : 'primary'">
76
83
  看板模式
77
84
  </a-button>
85
+ <!-- 头部附加栅格 -->
86
+ <x-report
87
+ v-if="attachGrid"
88
+ :env="env"
89
+ :isWidget="true"
90
+ :use-oss-for-img="false"
91
+ :config-name="attachGrid"
92
+ :show-img-in-cell="true"
93
+ :display-only="true"
94
+ :edit-mode="false"
95
+ :show-save-button="false"
96
+ :dont-format="true"/>
97
+
78
98
  <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
79
99
  </a-space>
80
100
 
81
101
  </span>
82
102
  </a-col>
83
- <a-col :span="8">
84
- <!-- 头部附加栅格 -->
85
- <x-report
86
- v-if="attachGrid"
87
- :env="env"
88
- :use-oss-for-img="false"
89
- :config-name="attachGrid"
90
- :show-img-in-cell="true"
91
- :display-only="true"
92
- :edit-mode="false"
93
- :show-save-button="false"
94
- :dont-format="true"/>
95
- </a-col>
96
- <a-col v-show="showRightTools && !simpleMode" :span="8">
103
+ <a-col v-show="showRightTools && !simpleMode">
97
104
  <span :style="{ float: 'right', overflow: 'hidden', marginBottom: '8px' }">
98
105
  <a-button-group>
99
106
  <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
@@ -137,7 +144,7 @@
137
144
  v-for="(item, c_index) in tableColumns"
138
145
  :slot="item.dataIndex"
139
146
  slot-scope="text, record, index">
140
- <template v-if="isEditMode && getFromItem(item.dataIndex)">
147
+ <template v-if="isEditMode && getFromItem(item.dataIndex,text, record, index)">
141
148
  <x-form-item
142
149
  class="innerTable"
143
150
  :form="record"
@@ -304,7 +311,7 @@ import {
304
311
  import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
305
312
  import { Modal } from 'ant-design-vue'
306
313
  import { mapState } from 'vuex'
307
- import { executeStrFunction } from '@vue2-client/utils/runEvalFunction'
314
+ import { executeStrFunction, executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
308
315
  import debounce from 'lodash.debounce'
309
316
  import XDataCard from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
310
317
  import { getRealKeyData } from '@vue2-client/utils/formatter'
@@ -514,10 +521,15 @@ export default {
514
521
  columnClick (key, value, record) {
515
522
  this.$emit('columnClick', key, value, record)
516
523
  },
517
- getFromItem (model) {
524
+ getFromItem (model, text, record, index) {
518
525
  const aa = this.formItems.find(item => item.model === model && item.editRow)
519
526
  if (aa) {
520
- return JSON.parse(JSON.stringify(aa))
527
+ const tempConfig = JSON.parse(JSON.stringify(aa))
528
+ if (tempConfig.editRowShowFunc) {
529
+ if (executeStrFunctionByContext(this, tempConfig.editRowShowFunc, [text, record, index, tempConfig])) {
530
+ return tempConfig
531
+ }
532
+ }
521
533
  }
522
534
  return false
523
535
  },
@@ -1026,12 +1038,12 @@ export default {
1026
1038
  },
1027
1039
  // 行选择业务
1028
1040
  choose () {
1029
- if (this.isChoose) {
1030
- // 如果配置了自定义函数
1031
- this.$emit('rowChoose', this.selectedRows)
1032
- } else {
1033
- this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1034
- }
1041
+ if (this.isChoose) {
1042
+ // 如果配置了自定义函数
1043
+ this.$emit('rowChoose', this.selectedRows)
1044
+ } else {
1045
+ this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1046
+ }
1035
1047
  },
1036
1048
  // 自定义按钮点击
1037
1049
  editButtonStateDataClick (index) {
@@ -19,7 +19,14 @@ export default {
19
19
  this.setupWebSocket(url)
20
20
 
21
21
  // 等待 WebSocket 连接成功
22
- await this.waitForWebSocketConnection()
22
+ const result = await this.waitForWebSocketConnection()
23
+
24
+ if (result) {
25
+ return {
26
+ code: 500,
27
+ msg: result
28
+ }
29
+ }
23
30
 
24
31
  this.isRecording = true
25
32
 
@@ -27,16 +34,22 @@ export default {
27
34
  this.audioContext = new (window.AudioContext || window.webkitAudioContext)()
28
35
 
29
36
  if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
30
- throw new Error(
31
- '录音软件不支持您的浏览器!请使用现代浏览器或确保您正在使用 HTTPS。'
32
- )
37
+ this.ws.close()
38
+ return {
39
+ code: 500,
40
+ msg: '录音软件不支持您的浏览器!请使用现代浏览器或确保您正在使用 HTTPS。'
41
+ }
33
42
  }
34
-
35
43
  // 获取麦克风输入流
36
44
  this.audioStream = await navigator.mediaDevices.getUserMedia({ audio: true })
37
45
 
38
46
  // 设置音频处理流程
39
47
  this.setupAudioProcessing()
48
+
49
+ return {
50
+ code: 200,
51
+ msg: '开始录音'
52
+ }
40
53
  },
41
54
 
42
55
  setupWebSocket (url) {
@@ -59,14 +72,14 @@ export default {
59
72
  },
60
73
 
61
74
  waitForWebSocketConnection () {
62
- return new Promise((resolve, reject) => {
75
+ return new Promise((resolve) => {
63
76
  this.ws.onopen = () => {
64
77
  console.log('WebSocket 连接成功')
65
78
  resolve()
66
79
  }
67
80
 
68
81
  this.ws.onerror = (error) => {
69
- reject(new Error('WebSocket 连接失败: ' + error.message))
82
+ resolve('WebSocket 连接失败: ' + error.message)
70
83
  }
71
84
  })
72
85
  },
@@ -93,9 +106,16 @@ export default {
93
106
 
94
107
  source.connect(processor)
95
108
  processor.connect(this.audioContext.destination)
109
+ return {
110
+ code: 200,
111
+ msg: '录音初始化成功'
112
+ }
96
113
  } catch (error) {
97
114
  console.error('Error setting up audio processing:', error)
98
- throw error
115
+ return {
116
+ code: 500,
117
+ msg: '录音初始化出错:' + error.message
118
+ }
99
119
  }
100
120
  },
101
121
 
@@ -110,6 +130,10 @@ export default {
110
130
  if (this.audioContext) {
111
131
  this.audioContext.close()
112
132
  }
133
+ return {
134
+ code: 200,
135
+ msg: '录音已停止'
136
+ }
113
137
  },
114
138
 
115
139
  saveAudioFile () {
@@ -199,10 +223,10 @@ export default {
199
223
  },
200
224
 
201
225
  getRecordingData () {
202
- return new Promise((resolve, reject) => {
226
+ return new Promise((resolve) => {
203
227
  if (!this.ws) {
204
228
  // 如果 WebSocket 未初始化,直接拒绝
205
- reject(this.inputData)
229
+ resolve(this.inputData)
206
230
  return
207
231
  }
208
232