vue2-client 1.9.89 → 1.9.90

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.90",
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,8 @@
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 v-if="buttonState.choose && buttonRendering('choose')" :disabled="!isChoose" type="primary"
15
+ @click="choose">
15
16
  <a-icon type="check-square"/>选择
16
17
  </a-button>
17
18
  <a-button
@@ -72,28 +73,29 @@
72
73
  <a-icon type="dashed" :style="iconStyle"/>
73
74
  {{ button.buttonName }}
74
75
  </a-button>
75
- <a-button v-if="allowedCardMode && !simpleMode" @click="changeViewMode" :type="isTableMode ? '' : 'primary'">
76
+ <a-button v-if="allowedCardMode && !simpleMode" @click="changeViewMode"
77
+ :type="isTableMode ? '' : 'primary'">
76
78
  看板模式
77
79
  </a-button>
80
+ <!-- 头部附加栅格 -->
81
+ <x-report
82
+ v-if="attachGrid"
83
+ :env="env"
84
+ :isWidget="true"
85
+ :use-oss-for-img="false"
86
+ :config-name="attachGrid"
87
+ :show-img-in-cell="true"
88
+ :display-only="true"
89
+ :edit-mode="false"
90
+ :show-save-button="false"
91
+ :dont-format="true"/>
92
+
78
93
  <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
79
94
  </a-space>
80
95
 
81
96
  </span>
82
97
  </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">
98
+ <a-col v-show="showRightTools && !simpleMode">
97
99
  <span :style="{ float: 'right', overflow: 'hidden', marginBottom: '8px' }">
98
100
  <a-button-group>
99
101
  <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
@@ -137,7 +139,7 @@
137
139
  v-for="(item, c_index) in tableColumns"
138
140
  :slot="item.dataIndex"
139
141
  slot-scope="text, record, index">
140
- <template v-if="isEditMode && getFromItem(item.dataIndex)">
142
+ <template v-if="isEditMode && getFromItem(item.dataIndex,text, record, index)">
141
143
  <x-form-item
142
144
  class="innerTable"
143
145
  :form="record"
@@ -284,11 +286,11 @@
284
286
  </div>
285
287
  </template>
286
288
  <script>
287
- import { Ellipsis, STable } from '@vue2-client/components'
288
- import util, { formatDate, getChangedData, setDataByRealKey } from '@vue2-client/utils/util'
289
+ import {Ellipsis, STable} from '@vue2-client/components'
290
+ import util, {formatDate, getChangedData, setDataByRealKey} from '@vue2-client/utils/util'
289
291
  import XBadge from '@vue2-client/base-client/components/common/XBadge'
290
292
  import TableSetting from '@vue2-client/components/TableSetting/TableSetting'
291
- import { exportJson } from '@vue2-client/utils/excel/Export2Excel'
293
+ import {exportJson} from '@vue2-client/utils/excel/Export2Excel'
292
294
  import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
293
295
  import {
294
296
  exportData,
@@ -302,12 +304,12 @@ import {
302
304
  runLogic
303
305
  } from '@vue2-client/services/api/common'
304
306
  import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
305
- import { Modal } from 'ant-design-vue'
306
- import { mapState } from 'vuex'
307
- import { executeStrFunction } from '@vue2-client/utils/runEvalFunction'
307
+ import {Modal} from 'ant-design-vue'
308
+ import {mapState} from 'vuex'
309
+ import {executeStrFunction, executeStrFunctionByContext} from '@vue2-client/utils/runEvalFunction'
308
310
  import debounce from 'lodash.debounce'
309
311
  import XDataCard from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
310
- import { getRealKeyData } from '@vue2-client/utils/formatter'
312
+ import {getRealKeyData} from '@vue2-client/utils/formatter'
311
313
  import ReportTableHome from '../../../../pages/report/ReportTableHome.vue'
312
314
 
313
315
  export default {
@@ -324,7 +326,7 @@ export default {
324
326
  ReportTableHome
325
327
  },
326
328
  inject: ['getSelf'],
327
- data () {
329
+ data() {
328
330
  return {
329
331
  uniqueId: `x-table-${this._uid}`, // 使用 _uid 生成唯一 ID
330
332
  // 筛选列加载状态
@@ -489,7 +491,7 @@ export default {
489
491
  }
490
492
  },
491
493
  computed: {
492
- rowSelection () {
494
+ rowSelection() {
493
495
  return {
494
496
  selectedRowKeys: this.selectedRowKeys,
495
497
  onChange: this.onSelectChange,
@@ -501,33 +503,38 @@ export default {
501
503
  }),
502
504
  }
503
505
  },
504
- ...mapState('account', { currUser: 'user' }),
506
+ ...mapState('account', {currUser: 'user'}),
505
507
  ...mapState('setting', ['compatible'])
506
508
  },
507
- mounted () {
509
+ mounted() {
508
510
  window.addEventListener('resize', this.handleResize)
509
511
  },
510
- beforeDestroy () {
512
+ beforeDestroy() {
511
513
  window.removeEventListener('resize', this.handleResize)
512
514
  },
513
515
  methods: {
514
- columnClick (key, value, record) {
516
+ columnClick(key, value, record) {
515
517
  this.$emit('columnClick', key, value, record)
516
518
  },
517
- getFromItem (model) {
519
+ getFromItem(model, text, record, index) {
518
520
  const aa = this.formItems.find(item => item.model === model && item.editRow)
519
521
  if (aa) {
520
- return JSON.parse(JSON.stringify(aa))
522
+ const tempConfig = JSON.parse(JSON.stringify(aa))
523
+ if (tempConfig.editRowShowFunc) {
524
+ if (executeStrFunctionByContext(this, tempConfig.editRowShowFunc, [text, record, index, tempConfig]) {
525
+ return tempConfig
526
+ }
527
+ }
521
528
  }
522
529
  return false
523
530
  },
524
531
  // 打开行编辑
525
- openEditMode () {
532
+ openEditMode() {
526
533
  this.isEditMode = true
527
534
  this.editRowBeforeData = JSON.parse(JSON.stringify(this.getTableData()))
528
535
  },
529
536
  // 标记行保存
530
- editRowSave () {
537
+ editRowSave() {
531
538
  // 获取最新数据
532
539
  const editRowAfterData = this.getTableData()
533
540
  const changeData = getChangedData(this.editRowBeforeData, editRowAfterData)
@@ -556,12 +563,12 @@ export default {
556
563
  })
557
564
  })
558
565
  },
559
- onCancel () {
566
+ onCancel() {
560
567
  }
561
568
  })
562
569
  }
563
570
  },
564
- importExcelOk () {
571
+ importExcelOk() {
565
572
  this.refresh(true)
566
573
  this.$emit('importExcelOk')
567
574
  },
@@ -570,7 +577,7 @@ export default {
570
577
  * @param row 选中行集合
571
578
  * @param attr 表单项属性
572
579
  */
573
- async rowChoose (row, attr, callback, record) {
580
+ async rowChoose(row, attr, callback, record) {
574
581
  // 如果配置了自定义函数
575
582
  if (attr.dataChangeFunc) {
576
583
  await executeStrFunction(attr.dataChangeFunc, [record, this.setForm, {
@@ -585,15 +592,15 @@ export default {
585
592
  callback()
586
593
  }
587
594
  },
588
- setForm (record, obj) {
595
+ setForm(record, obj) {
589
596
  Object.assign(record, obj)
590
597
  },
591
- handleResize () {
598
+ handleResize() {
592
599
  debounce(() => {
593
600
  this.setScrollYHeight({})
594
601
  }, 100)()
595
602
  },
596
- isInAModal () {
603
+ isInAModal() {
597
604
  let parent = this.$parent
598
605
  while (parent) {
599
606
  // 检查组件名称,这里假设a-modal组件的名称为AModal,根据实际情况可能需要调整
@@ -606,7 +613,7 @@ export default {
606
613
  },
607
614
  executeStrFunction,
608
615
  // 切换看板模式和表格模式
609
- changeViewMode () {
616
+ changeViewMode() {
610
617
  this.isTableMode = !this.isTableMode
611
618
  // 看板切换回表格模式 刷新列表
612
619
  if (this.isTableMode) {
@@ -616,7 +623,7 @@ export default {
616
623
  /**
617
624
  * 初始化表格参数
618
625
  */
619
- init (params) {
626
+ init(params) {
620
627
  const {
621
628
  // 查询参数对象, 用于没有对应查询配置文件名时
622
629
  queryParams,
@@ -733,7 +740,7 @@ export default {
733
740
  }
734
741
  },
735
742
  // 操作面板按钮渲染
736
- buttonRendering (button) {
743
+ buttonRendering(button) {
737
744
  if (!this.buttonPermissions) {
738
745
  return true
739
746
  }
@@ -755,11 +762,11 @@ export default {
755
762
  * 加载表格数据
756
763
  * @param requestParameters 请求参数
757
764
  */
758
- async loadTableData (requestParameters) {
765
+ async loadTableData(requestParameters) {
759
766
  let result
760
767
  if (this.localEditMode) {
761
768
  if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
762
- const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
769
+ const result = await query(Object.assign(requestParameters, {userId: this.currUser?.id}),
763
770
  this.serviceName, this.env === 'dev')
764
771
  if (result.data) {
765
772
  let no = 0
@@ -777,7 +784,7 @@ export default {
777
784
  })
778
785
  })
779
786
  } else {
780
- result = query(Object.assign(requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
787
+ result = query(Object.assign(requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev')
781
788
  }
782
789
  if (this.isTableMode && !this.simpleMode) {
783
790
  this.clearRowKeys()
@@ -791,11 +798,11 @@ export default {
791
798
  * @param actionType 操作类型
792
799
  * @param func 事件默认 action
793
800
  */
794
- action (record, actionType, func = 'action') {
801
+ action(record, actionType, func = 'action') {
795
802
  this.$emit('action', record, record[this.getPrimaryKeyName()], actionType, func)
796
803
  },
797
804
  // 看板点击事件
798
- handleCardEmit (data, eventName) {
805
+ handleCardEmit(data, eventName) {
799
806
  this.action(data, undefined, eventName)
800
807
  },
801
808
  /**
@@ -803,7 +810,7 @@ export default {
803
810
  * @param selectedRowKeys 被选择的列Key集合
804
811
  * @param selectedRows 被选择的列集合
805
812
  */
806
- onSelectChange (selectedRowKeys, selectedRows) {
813
+ onSelectChange(selectedRowKeys, selectedRows) {
807
814
  this.selectedRowKeys = selectedRowKeys
808
815
  this.selectedRows = selectedRows
809
816
  this.isModify = this.selectedRowKeys.length === 1
@@ -814,13 +821,13 @@ export default {
814
821
  /**
815
822
  * 清除表格选中项
816
823
  */
817
- clearRowKeys () {
824
+ clearRowKeys() {
818
825
  this.$refs.table.clearSelected()
819
826
  },
820
827
  /**
821
828
  * 为表格附加查询条件
822
829
  */
823
- setQueryForm (form = {}) {
830
+ setQueryForm(form = {}) {
824
831
  this.form = form
825
832
  if (this.createdQuery) {
826
833
  this.refresh(true)
@@ -832,12 +839,12 @@ export default {
832
839
  * 表格重新加载方法
833
840
  * 如果参数为 true, 则强制刷新到第一页
834
841
  */
835
- refresh (bool) {
842
+ refresh(bool) {
836
843
  this.$nextTick(() => {
837
844
  this.$refs.table.refresh(bool)
838
845
  })
839
846
  },
840
- setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
847
+ setScrollYHeight({extraHeight = this.extraHeight, id = this.uniqueId, type = ''}) {
841
848
  this.$nextTick(() => {
842
849
  setTimeout(() => {
843
850
  const curDocument = window?.rawDocument || document
@@ -894,7 +901,7 @@ export default {
894
901
  * @param date 日期字符串
895
902
  * @param format 格式化方式
896
903
  */
897
- format (date, format) {
904
+ format(date, format) {
898
905
  return formatDate(date, format)
899
906
  },
900
907
  /**
@@ -902,7 +909,7 @@ export default {
902
909
  * @param number string 或者 number
903
910
  * @param decimalPlaces 小数位数
904
911
  */
905
- numberFormat (number, decimalPlaces = 2) {
912
+ numberFormat(number, decimalPlaces = 2) {
906
913
  const value = parseFloat(number)
907
914
  if (!isNaN(value)) {
908
915
  return value.toFixed(decimalPlaces)
@@ -913,7 +920,7 @@ export default {
913
920
  /**
914
921
  * 获取主键列名称
915
922
  */
916
- getPrimaryKeyName () {
923
+ getPrimaryKeyName() {
917
924
  if (this.primaryKey) {
918
925
  return this.primaryKey
919
926
  }
@@ -921,7 +928,7 @@ export default {
921
928
  return indexColumn ? indexColumn.dataIndex : this.tableColumns[0].dataIndex
922
929
  },
923
930
  // 导出选中或本页数据
924
- handleExport (isSelected) {
931
+ handleExport(isSelected) {
925
932
  const tHeader = this.tableColumns.filter(res => res.slotType !== 'action').map(res => res.title)
926
933
  const filterVal = this.tableColumns.map(res => res.dataIndex)
927
934
  let exportData
@@ -933,13 +940,13 @@ export default {
933
940
  exportJson(tHeader, exportData.map(v => filterVal.map(j => v[j])), this.title + `数据_${new Date().toLocaleString()}`)
934
941
  },
935
942
  // 导出符合条件的数据
936
- handleExportByQuery () {
943
+ handleExportByQuery() {
937
944
  const that = this
938
945
  const conditionParams = Object.assign(that.form, that.fixedQueryForm)
939
946
  this.$confirm({
940
947
  title: '是否确认导出?',
941
948
  content: '此操作将导出当前条件下所有数据而非选中数据',
942
- onOk () {
949
+ onOk() {
943
950
  exportData({
944
951
  queryParamsName: that.queryParamsName,
945
952
  queryParams: that.queryParams,
@@ -954,11 +961,11 @@ export default {
954
961
  window.open(value)
955
962
  })
956
963
  },
957
- onCancel () {
964
+ onCancel() {
958
965
  }
959
966
  })
960
967
  },
961
- handleAsyncExportByQuery () {
968
+ handleAsyncExportByQuery() {
962
969
  const that = this
963
970
  const conditionParams = Object.assign(that.form, that.fixedQueryForm)
964
971
  this.$confirm({
@@ -1004,20 +1011,20 @@ export default {
1004
1011
  console.log('失败:', error)
1005
1012
  })
1006
1013
  },
1007
- onCancel () {
1014
+ onCancel() {
1008
1015
  }
1009
1016
  })
1010
1017
  },
1011
1018
  // 新增业务
1012
- add () {
1019
+ add() {
1013
1020
  this.$emit('add')
1014
1021
  },
1015
1022
  // 添加业务
1016
- move () {
1023
+ move() {
1017
1024
  this.$emit('move')
1018
1025
  },
1019
1026
  // 编辑业务
1020
- edit (id) {
1027
+ edit(id) {
1021
1028
  this.editLoading = true
1022
1029
  this.getEditData(id).then(modifyModelData => {
1023
1030
  this.$emit('edit', modifyModelData)
@@ -1025,20 +1032,20 @@ export default {
1025
1032
  })
1026
1033
  },
1027
1034
  // 行选择业务
1028
- choose () {
1029
- if (this.isChoose) {
1030
- // 如果配置了自定义函数
1031
- this.$emit('rowChoose', this.selectedRows)
1032
- } else {
1033
- this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1034
- }
1035
+ choose() {
1036
+ if (this.isChoose) {
1037
+ // 如果配置了自定义函数
1038
+ this.$emit('rowChoose', this.selectedRows)
1039
+ } else {
1040
+ this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1041
+ }
1035
1042
  },
1036
1043
  // 自定义按钮点击
1037
- editButtonStateDataClick (index) {
1044
+ editButtonStateDataClick(index) {
1038
1045
  this.$emit('editButtonStateDataClick', this.editButtonStateData[index].functionName, this.selectedRows)
1039
1046
  },
1040
1047
  // 获取被编辑的数据
1041
- getEditData (id) {
1048
+ getEditData(id) {
1042
1049
  if (!id) {
1043
1050
  this.selectId = this.selectedRowKeys[0]
1044
1051
  } else {
@@ -1070,11 +1077,11 @@ export default {
1070
1077
  requestParameters.conditionParams[primaryKeyName] = this.selectId
1071
1078
  requestParameters.f_businessid = this.selectId
1072
1079
  return queryWithResource(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1073
- return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
1080
+ return {data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files}
1074
1081
  })
1075
1082
  },
1076
1083
  // 删除业务
1077
- deleteItem () {
1084
+ deleteItem() {
1078
1085
  if (this.viewMode) {
1079
1086
  this.$message.info('预览模式禁止删除')
1080
1087
  return
@@ -1112,20 +1119,20 @@ export default {
1112
1119
  }
1113
1120
  })
1114
1121
  },
1115
- onCancel () {
1122
+ onCancel() {
1116
1123
  }
1117
1124
  })
1118
1125
  },
1119
1126
  // 导入业务
1120
- importData () {
1127
+ importData() {
1121
1128
  this.$refs.importExcel.importExcelHandleOpen()
1122
1129
  },
1123
- afterVisibleChange () {
1130
+ afterVisibleChange() {
1124
1131
  this.retrieveSummaryData()
1125
1132
  },
1126
- async retrieveSummaryData () {
1133
+ async retrieveSummaryData() {
1127
1134
  if (this.requestParameters.querySummary) {
1128
- querySummary(Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev').then(res => {
1135
+ querySummary(Object.assign(this.requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev').then(res => {
1129
1136
  if (res.length > 0) {
1130
1137
  this.summaryData.forEach(item => {
1131
1138
  res.forEach(summary => {
@@ -1141,7 +1148,7 @@ export default {
1141
1148
  }
1142
1149
  if (this.showCustomSummary) {
1143
1150
  this.customSummaryArray.forEach(item => {
1144
- runLogic(item.source, Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev').then((res) => {
1151
+ runLogic(item.source, Object.assign(this.requestParameters, {userId: this.currUser?.id}), this.serviceName, this.env === 'dev').then((res) => {
1145
1152
  this.summaryData.forEach(summary => {
1146
1153
  if (item.key === summary.key) {
1147
1154
  summary.value = res.value
@@ -1161,7 +1168,7 @@ export default {
1161
1168
  })
1162
1169
  }
1163
1170
  },
1164
- showDrawer () {
1171
+ showDrawer() {
1165
1172
  if (this.summaryUpdate) {
1166
1173
  this.summaryData.forEach(item => {
1167
1174
  item.loading = true
@@ -1173,36 +1180,36 @@ export default {
1173
1180
  this.$message.warning('请查询后再来查看')
1174
1181
  }
1175
1182
  },
1176
- onClose () {
1183
+ onClose() {
1177
1184
  this.summaryDrawerVisible = false
1178
1185
  },
1179
1186
  // 获取表格内所有数据
1180
- getTableData () {
1187
+ getTableData() {
1181
1188
  return this.$refs.table.localDataSource
1182
1189
  },
1183
1190
  // 设置表格内数据
1184
- setTableData (data) {
1185
- Object.assign(this.$refs.table, { localDataSource: data })
1191
+ setTableData(data) {
1192
+ Object.assign(this.$refs.table, {localDataSource: data})
1186
1193
  },
1187
1194
  // 获取所有本地数据
1188
- getLocalData () {
1195
+ getLocalData() {
1189
1196
  return this.localEditModeDataSource
1190
1197
  },
1191
1198
  // 获取指定rowKey的value的本地数据
1192
- getDataByRowKeyValue (rowKeyValue) {
1199
+ getDataByRowKeyValue(rowKeyValue) {
1193
1200
  return this.getLocalData().find(item => {
1194
1201
  return item[this.rowKey] === rowKeyValue
1195
1202
  })
1196
1203
  },
1197
1204
  // 修改本地数据
1198
- modifyLocalData (rowKeyValue, data) {
1205
+ modifyLocalData(rowKeyValue, data) {
1199
1206
  const modifyItem = this.getDataByRowKeyValue(rowKeyValue)
1200
1207
  if (modifyItem) {
1201
1208
  Object.assign(modifyItem, data)
1202
1209
  }
1203
1210
  },
1204
1211
  // 追加本地数据
1205
- appendLocalData (item) {
1212
+ appendLocalData(item) {
1206
1213
  item['序号'] = this.localEditModeDataSource.length
1207
1214
  this.localEditModeDataSource.push(item)
1208
1215
  }
@@ -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