vue2-client 1.18.18 → 1.18.20

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.18.18",
3
+ "version": "1.18.20",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -268,6 +268,23 @@ const isHiddenFunctionalArea = computed(() => {
268
268
  }
269
269
  }
270
270
 
271
+ // 修复数据量少时下拉框被挡住的问题:为表格内容区域设置最小高度
272
+ // 当表格有数据时,确保表格内容区域有足够高度,避免下拉框被挡住
273
+ // 注意:只在表格有数据时应用,避免空表格时显示问题
274
+ :deep(.table-wrapper) {
275
+ .ant-table:not(.ant-table-empty) {
276
+ .ant-table-content {
277
+ // 设置最小高度,确保即使数据少时也有足够空间显示下拉框
278
+ // 这个高度应该足够显示下拉框选项(通常下拉框高度约200-300px)
279
+ min-height: 300px;
280
+ .ant-table-body {
281
+ // 确保表格体也有最小高度,保证滚动容器有足够空间
282
+ min-height: 250px;
283
+ }
284
+ }
285
+ }
286
+ }
287
+
271
288
  // 表格样式
272
289
  &.h-form-table-table {
273
290
  :deep(.ant-table-small .ant-table-fixed-header) {
@@ -48,13 +48,19 @@
48
48
  <div v-if="crudTitle" class="crud_title">
49
49
  {{ crudTitle }}
50
50
  </div>
51
- <x-form
52
- ref="xForm"
53
- @x-form-item-emit-func="emitFunc"
54
- @toggleAdvanced="toggleAdvanced"
55
- @onSubmit="onSearchSubmit">
56
- <slot name="formBtnExpand"></slot>
57
- </x-form>
51
+ <div class="xform-wrapper">
52
+ <x-form
53
+ ref="xForm"
54
+ @x-form-item-emit-func="emitFunc"
55
+ @toggleAdvanced="toggleAdvanced"
56
+ @onSubmit="onSearchSubmit">
57
+ <slot name="formBtnExpand"></slot>
58
+ </x-form>
59
+ <!-- 弹框模式下的表单查询加载遮罩(局部覆盖) -->
60
+ <div v-if="tableShowMode === 'popup' && formQueryLoading" class="form-query-loading">
61
+ <a-spin size="large" tip="正在查询..." />
62
+ </div>
63
+ </div>
58
64
  <!-- 默认模式:直接展示表格 -->
59
65
  <x-table
60
66
  v-if="tableShowMode === 'default'"
@@ -115,13 +121,15 @@
115
121
  <!-- 弹框模式:在 Modal 中展示表格 -->
116
122
  <a-modal
117
123
  v-if="tableShowMode === 'popup'"
118
- v-model="tableModalVisible"
124
+ :visible="tableModalVisible"
125
+ @cancel="closeTableModal"
119
126
  :title="realQueryConfig.popupTitle || null"
120
127
  :closable="false"
121
128
  width="80%"
122
129
  :bodyStyle="{ padding: '12px' }"
123
130
  :footer="null"
124
131
  :destroyOnClose="false"
132
+ :forceRender="true"
125
133
  :z-index="1005"
126
134
  >
127
135
  <x-table
@@ -324,8 +332,8 @@ export default {
324
332
  tableShowMode: 'default',
325
333
  // Modal 弹框显示状态
326
334
  tableModalVisible: false,
327
- // 弹框模式下待初始化的表格配置
328
- pendingTableInit: null
335
+ // 弹框模式下表单查询中的加载状态
336
+ formQueryLoading: false
329
337
  }
330
338
  },
331
339
  computed: {
@@ -427,6 +435,11 @@ export default {
427
435
  return 0
428
436
  }
429
437
  },
438
+ // 弹框模式下,最少多少行数据才自动弹框展示
439
+ minShowRows: {
440
+ type: Number,
441
+ default: 1
442
+ },
430
443
  // 环境
431
444
  env: {
432
445
  type: String,
@@ -674,34 +687,7 @@ export default {
674
687
  }
675
688
  const localEditMode = !this.localEditMode ? res.localEditMode : this.localEditMode
676
689
  const initTable = () => {
677
- // 弹框模式下,如果 xTable 还未渲染,保存初始化配置供后续使用
678
- if (this.tableShowMode === 'popup' && !this.$refs.xTable) {
679
- // 保存初始化配置
680
- this.pendingTableInit = {
681
- formItems: res.formJson,
682
- queryParams: setQueryParams ? res : null,
683
- realQueryParams: res,
684
- tableColumns: res.columnJson,
685
- buttonState: Object.assign(res.buttonState, this.buttonState),
686
- title: this.title || res.title,
687
- viewMode: this.viewMode,
688
- localEditMode: localEditMode,
689
- rowSelectMode: this.rowSelectMode,
690
- allowSelectRowNum: this.allowSelectRowNum,
691
- tableSummaryMap: res.tableSummaryMap,
692
- serviceName: this.serviceName,
693
- env: this.env,
694
- form: this.$refs.xForm.form,
695
- summaryUpdate: true,
696
- disableAction: this.disableAction,
697
- extraData: this.extraData,
698
- rowStyleFunction: res.rowStyleFunction,
699
- ...res
700
- }
701
- return
702
- }
703
-
704
- // 初始化 xTable 子组件
690
+ // 初始化 xTable 子组件(弹框模式下由于 forceRender,xTable 已经渲染)
705
691
  if (this.$refs.xTable) {
706
692
  this.$refs.xTable.init({
707
693
  formItems: res.formJson,
@@ -765,29 +751,14 @@ export default {
765
751
  */
766
752
  onSearchSubmit (res) {
767
753
  if (res.valid) {
768
- // 如果是弹框模式,先打开 Modal,等待 DOM 更新后再设置查询表单
754
+ // 如果是弹框模式,显示表单加载动画,不立即打开弹框
769
755
  if (this.tableShowMode === 'popup') {
770
- this.tableModalVisible = true
771
- this.$nextTick(() => {
772
- // 等待 Modal 中的 x-table 渲染完成
773
- if (this.$refs.xTable) {
774
- // 如果有待初始化的配置,先初始化表格
775
- if (this.pendingTableInit) {
776
- this.$refs.xTable.init(this.pendingTableInit)
777
- this.$emit('afterTableInit')
778
- this.pendingTableInit = null
779
- }
780
- // 设置查询表单
781
- this.$refs.xTable.setQueryForm(res.form)
782
- this.$refs.xTable.summaryUpdate = true
783
- }
784
- })
785
- } else {
786
- // 默认模式:直接设置查询表单
787
- this.$refs.xTable.setQueryForm(res.form)
788
- this.$refs.xTable.summaryUpdate = true
756
+ // 开启表单查询加载状态
757
+ this.formQueryLoading = true
789
758
  }
790
-
759
+ // 默认模式:直接设置查询表单
760
+ this.$refs.xTable.setQueryForm(res.form)
761
+ this.$refs.xTable.summaryUpdate = true
791
762
  // commit
792
763
  this.$emit('afterSearchSubmit', res)
793
764
  } else {
@@ -829,10 +800,28 @@ export default {
829
800
  },
830
801
  /**
831
802
  * 表格查询后事件
832
- * @param res 参数
803
+ * @param res 参数(可能是 Promise)
833
804
  * @param conditionParams 查询条件
834
805
  */
835
- afterQuery (res, conditionParams) {
806
+ async afterQuery (res, conditionParams) {
807
+ // 如果是弹框模式且正在查询中
808
+ if (this.tableShowMode === 'popup' && this.formQueryLoading) {
809
+ // 兼容 Promise
810
+ const realRes = await res
811
+ // 结束表单加载状态
812
+ this.formQueryLoading = false
813
+ // 兼容 data / records 两种结构
814
+ const rows = realRes && (realRes.data || realRes.records || [])
815
+ // 判断是否有数据(行数 >= minShowRows)
816
+ const hasData = Array.isArray(rows) && rows.length >= this.minShowRows
817
+
818
+ if (hasData) {
819
+ // 有数据:打开弹框展示
820
+ this.tableModalVisible = true
821
+ }
822
+ }
823
+
824
+ // 继续触发父组件的 afterQuery 事件(保持原有行为)
836
825
  this.$emit('afterQuery', res, conditionParams)
837
826
  },
838
827
  /**
@@ -1002,6 +991,9 @@ export default {
1002
991
  * @param toFirstPage 是否到第一页
1003
992
  */
1004
993
  refreshTable (toFirstPage = true) {
994
+ if (this.tableShowMode === 'popup') {
995
+ this.formQueryLoading = true
996
+ }
1005
997
  this.$refs.xTable.refresh(toFirstPage)
1006
998
  },
1007
999
  /**
@@ -1009,6 +1001,9 @@ export default {
1009
1001
  * @param toFirstPage 是否到第一页
1010
1002
  */
1011
1003
  refresh (toFirstPage = true) {
1004
+ if (this.tableShowMode === 'popup') {
1005
+ this.formQueryLoading = true
1006
+ }
1012
1007
  this.$refs.xTable.refresh(toFirstPage)
1013
1008
  },
1014
1009
  /**
@@ -1262,4 +1257,24 @@ export default {
1262
1257
  line-height: 1.5;
1263
1258
  }
1264
1259
 
1260
+ /* 表单容器,用于定位 loading */
1261
+ .xform-wrapper {
1262
+ position: relative;
1263
+ }
1264
+
1265
+ /* 表单查询加载遮罩(局部覆盖) */
1266
+ .form-query-loading {
1267
+ position: absolute;
1268
+ top: 0;
1269
+ left: 0;
1270
+ right: 0;
1271
+ bottom: 0;
1272
+ background-color: rgba(255, 255, 255, 0.7);
1273
+ display: flex;
1274
+ justify-content: center;
1275
+ align-items: center;
1276
+ z-index: 10;
1277
+ backdrop-filter: blur(1px);
1278
+ }
1279
+
1265
1280
  </style>
@@ -55,8 +55,8 @@ path: 'example',
55
55
  name: '示例主页面',
56
56
  // component: () => import('@vue2-client/base-client/components/his/HChart/demo.vue'),
57
57
  // component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
58
- // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
59
- component: () => import('@vue2-client/components/xScrollBox/example.vue'),
58
+ component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
59
+ // component: () => import('@vue2-client/components/xScrollBox/example.vue'),
60
60
  // component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
61
61
  // component: () => import('@vue2-client/pages/addressSelect/addressDemo.vue'),
62
62
  // component: () => import('@vue2-client/base-client/components/common/XDescriptions/demo.vue'),