vue2-client 1.19.57 → 1.19.59

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.19.57",
3
+ "version": "1.19.59",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -81,18 +81,23 @@
81
81
  key="workFlowTab"
82
82
  tab="表单"
83
83
  >
84
+ <work-flow-preview v-if="historyFormCompletedDataPreview" :form-completed-data-preview="historyFormCompletedDataPreview" :showTitle="false"/>
85
+ <a-divider/>
84
86
  <x-add-native-form
85
87
  ref="xAddForm"
86
88
  @x-form-item-emit-func="formItemEmitFunc"
87
89
  @onSubmit="submitForm"/>
88
90
  </a-tab-pane>
89
91
  </x-tab>
90
- <x-add-native-form
91
- v-else
92
- ref="xAddForm"
93
- @x-form-item-emit-func="formItemEmitFunc"
94
- @onSubmit="submitForm"/>
95
- <a-divider/>
92
+ <div v-else>
93
+ <work-flow-preview v-if="historyFormCompletedDataPreview" :form-completed-data-preview="historyFormCompletedDataPreview" :showTitle="false"/>
94
+ <a-divider/>
95
+ <x-add-native-form
96
+ ref="xAddForm"
97
+ @x-form-item-emit-func="formItemEmitFunc"
98
+ @onSubmit="submitForm"/>
99
+ <a-divider/>
100
+ </div>
96
101
 
97
102
  <!-- 分支节点状态提示 -->
98
103
  <a-alert
@@ -486,6 +491,7 @@ export default {
486
491
  formCompletedData: {},
487
492
  // 用于展示提交的数据
488
493
  formCompletedDataPreview: null,
494
+ historyFormCompletedDataPreview: null,
489
495
  // 切换至目标流程时,目标流程定义
490
496
  targetStepDefine: [],
491
497
  // 控制历史记录加载
@@ -953,8 +959,78 @@ export default {
953
959
  // 获取当前步骤定义内容,构建组件
954
960
  async buildComp (stepId) {
955
961
  const properties = this.stepsDefine.find(item => item.id === stepId).properties
962
+ this.historyFormCompletedDataPreview = null
956
963
  // 表单的渲染
957
964
  if (properties.form && properties.form.formJson) {
965
+ if (properties.otherProperty && properties.otherProperty.historyFormData) {
966
+ const historyFormDataConfig = properties.otherProperty.historyFormData
967
+
968
+ // 收集所有需要查询的步骤和字段映射关系
969
+ const configItems = []
970
+ const stepIdSet = new Set()
971
+
972
+ for (const historyFormConfig of historyFormDataConfig) {
973
+ const stepConfig = this.stepsDefine.find(item => item.name === historyFormConfig.stepName)
974
+ if (!stepConfig) {
975
+ continue
976
+ }
977
+
978
+ const stepId = stepConfig.id
979
+ const stepFormJson = stepConfig?.properties?.form?.formJson
980
+ if (!stepFormJson) {
981
+ continue
982
+ }
983
+
984
+ const formItem = stepFormJson.find(item => item.name === historyFormConfig.formLabel)
985
+ const model = formItem?.model
986
+
987
+ if (!model) {
988
+ continue
989
+ }
990
+
991
+ // 收集配置项和需要查询的 stepId
992
+ configItems.push({
993
+ stepId,
994
+ model,
995
+ displayLabel: historyFormConfig.displayLabel
996
+ })
997
+ stepIdSet.add(stepId)
998
+ }
999
+
1000
+ // 批量查询:每个 stepId 只查询一次,并行执行
1001
+ const formDataCache = new Map()
1002
+ const queryPromises = Array.from(stepIdSet).map(async stepId => {
1003
+ try {
1004
+ const formData = await postByServiceName(
1005
+ workFlowViewApi.getWorkFlowCompletedStepData,
1006
+ { workflowId: this.workflowId, stepId }
1007
+ )
1008
+ formDataCache.set(stepId, formData.data || {})
1009
+ } catch (error) {
1010
+ console.error(`查询步骤 ${stepId} 的数据失败:`, error)
1011
+ formDataCache.set(stepId, {})
1012
+ }
1013
+ })
1014
+
1015
+ // 等待所有查询完成
1016
+ await Promise.all(queryPromises)
1017
+
1018
+ // 组装历史表单数据
1019
+ const historyFormData = configItems.map(configItem => {
1020
+ const cachedFormData = formDataCache.get(configItem.stepId)
1021
+ return {
1022
+ label: configItem.displayLabel,
1023
+ value: cachedFormData?.[configItem.model]
1024
+ }
1025
+ })
1026
+
1027
+ this.historyFormCompletedDataPreview = {
1028
+ data: historyFormData,
1029
+ images: [],
1030
+ files: [],
1031
+ note: ''
1032
+ }
1033
+ }
958
1034
  this.stepDefine = properties.form.formJson
959
1035
  this.showForm = true
960
1036
  this.$nextTick(() => {
@@ -7,7 +7,7 @@
7
7
  bordered
8
8
  class="descriptionPreviewItem"
9
9
  >
10
- <p slot="title" class="descriptionTitle">
10
+ <p slot="title" class="descriptionTitle" v-if="showTitle">
11
11
  填写历史
12
12
  </p>
13
13
  <template v-if="legacyMode">
@@ -97,7 +97,11 @@ export default {
97
97
  legacyMode: {
98
98
  type: Boolean,
99
99
  default: false
100
- }
100
+ },
101
+ showTitle: {
102
+ type: Boolean,
103
+ default: true
104
+ },
101
105
  },
102
106
  computed: {
103
107
  noData () {