verce-vue-test 0.0.138 → 0.0.140

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": "verce-vue-test",
3
- "version": "0.0.138",
3
+ "version": "0.0.140",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -824,6 +824,37 @@ initColumns()
824
824
  width: 100%;
825
825
  }
826
826
 
827
+ /**
828
+ * 小尺寸表格样式:压缩单元格上下留白,并加粗底部横向滚动条的可操作区域。
829
+ */
830
+ .el-table-plus :deep(.el-table--small) {
831
+ --el-table-text-color: #000;
832
+ --el-table-header-text-color: #000;
833
+ color: #000;
834
+ }
835
+
836
+ .el-table-plus :deep(.el-table--small .el-table__cell) {
837
+ padding: 0 !important;
838
+ }
839
+
840
+ .el-table-plus :deep(.el-table--small .cell) {
841
+ line-height: 20px !important;
842
+ color: #000 !important;
843
+ }
844
+
845
+ .el-table-plus :deep(.el-table--small .el-table__empty-text) {
846
+ color: #000;
847
+ }
848
+
849
+ .el-table-plus :deep(.el-table--small .el-table-column--selection > .cell) {
850
+ height: 20px;
851
+ }
852
+
853
+ .el-table-plus :deep(.el-table--small .el-table__body-wrapper .el-scrollbar__bar.is-horizontal) {
854
+ height: 20px;
855
+ bottom: 0;
856
+ }
857
+
827
858
  /**
828
859
  * 工具栏样式
829
860
  */
@@ -17,9 +17,7 @@ import {
17
17
  } from '@element-plus/icons-vue'
18
18
  import {
19
19
  formatDate,
20
- type ForecastStatus,
21
20
  type ForeignPositionForecast,
22
- type VerifyStatus,
23
21
  } from './model'
24
22
  import {
25
23
  foreignPositionForecastBusinessContext,
@@ -127,14 +125,6 @@ function formatMoney(value: number) {
127
125
  })
128
126
  }
129
127
 
130
- function statusTagType(status: ForecastStatus) {
131
- return ['PS01', 'PS02', 'PS06', 'PS07'].includes(status) ? 'primary' : 'info'
132
- }
133
-
134
- function verifyTagType(status: VerifyStatus) {
135
- return status === 'VS03' ? 'info' : 'primary'
136
- }
137
-
138
128
  function validateAmountRange() {
139
129
  const { minAmount, maxAmount } = filterForm.value
140
130
  const componentValid = amountRangeRef.value?.validate() ?? amountRangeValid.value
@@ -301,6 +291,24 @@ function getDeleteRestriction(row: ForeignPositionForecast) {
301
291
  return ''
302
292
  }
303
293
 
294
+ const singleSelectedRow = computed(() => (
295
+ selectedRows.value.length === 1 ? selectedRows.value[0] : null
296
+ ))
297
+
298
+ const singleSelectionTip = computed(() => {
299
+ if (selectedRows.value.length === 0) return '请选择一条数据'
300
+ if (selectedRows.value.length > 1) return '仅支持选择一条数据,请取消多余选择'
301
+ return ''
302
+ })
303
+
304
+ const selectedEditRestriction = computed(() => (
305
+ singleSelectedRow.value ? getEditRestriction(singleSelectedRow.value) : ''
306
+ ))
307
+
308
+ const selectedDeleteRestriction = computed(() => (
309
+ singleSelectedRow.value ? getDeleteRestriction(singleSelectedRow.value) : ''
310
+ ))
311
+
304
312
  function openAddEditor() {
305
313
  clearTableSelection()
306
314
  editorMode.value = 'add'
@@ -427,6 +435,21 @@ async function handleAuthorization(row: ForeignPositionForecast) {
427
435
  }
428
436
  }
429
437
 
438
+ function handleSelectedEdit() {
439
+ if (!singleSelectedRow.value) return
440
+ void openEditEditor(singleSelectedRow.value)
441
+ }
442
+
443
+ function handleSelectedDelete() {
444
+ if (!singleSelectedRow.value) return
445
+ void handleDelete(singleSelectedRow.value)
446
+ }
447
+
448
+ function handleSelectedAuthorization() {
449
+ if (!singleSelectedRow.value) return
450
+ void handleAuthorization(singleSelectedRow.value)
451
+ }
452
+
430
453
  async function handleApproval(approved: boolean) {
431
454
  if (approvalAction.value) return
432
455
 
@@ -499,7 +522,7 @@ onBeforeUnmount(() => {
499
522
 
500
523
  <template v-else>
501
524
  <section class="query-panel" aria-label="外币头寸预报查询条件">
502
- <el-form :model="filterForm" label-position="top" size="small" class="query-form">
525
+ <el-form :model="filterForm" label-position="top" size="small" class="query-form" @submit.prevent="handleQuery">
503
526
  <div class="query-grid" :class="{ 'is-collapsed': filterCollapsed }">
504
527
  <el-form-item label="起息日">
505
528
  <el-date-picker
@@ -611,20 +634,20 @@ onBeforeUnmount(() => {
611
634
  @validate="amountRangeValid = $event"
612
635
  />
613
636
  </el-form-item>
614
- </div>
615
637
 
616
- <div class="query-actions">
617
- <el-button
618
- text
619
- type="primary"
620
- :icon="filterCollapsed ? ArrowDown : ArrowUp"
621
- :aria-expanded="!filterCollapsed"
622
- @click="filterCollapsed = !filterCollapsed"
623
- >
624
- {{ filterCollapsed ? '展开筛选' : '收起筛选' }}
625
- </el-button>
626
- <el-button :icon="RefreshLeft" @click="handleReset">重置</el-button>
627
- <el-button type="primary" :icon="Search" :loading="isQuerying" @click="handleQuery">查询</el-button>
638
+ <div class="query-actions">
639
+ <el-button
640
+ text
641
+ type="primary"
642
+ :icon="filterCollapsed ? ArrowDown : ArrowUp"
643
+ :aria-expanded="!filterCollapsed"
644
+ @click="filterCollapsed = !filterCollapsed"
645
+ >
646
+ {{ filterCollapsed ? '展开筛选' : '收起筛选' }}
647
+ </el-button>
648
+ <el-button :icon="RefreshLeft" @click="handleReset">重置</el-button>
649
+ <el-button native-type="submit" type="primary" :icon="Search" :loading="isQuerying">查询</el-button>
650
+ </div>
628
651
  </div>
629
652
  </el-form>
630
653
  </section>
@@ -679,6 +702,64 @@ onBeforeUnmount(() => {
679
702
  <template #toolbar>
680
703
  <div class="table-toolbar-actions">
681
704
  <el-button size="small" type="primary" :icon="Plus" @click="openAddEditor">新增</el-button>
705
+ <el-tooltip
706
+ :content="selectedEditRestriction || singleSelectionTip"
707
+ placement="top"
708
+ :show-after="200"
709
+ :disabled="selectedRows.length === 1 && !selectedEditRestriction"
710
+ >
711
+ <span class="toolbar-action-tooltip">
712
+ <el-button
713
+ size="small"
714
+ type="primary"
715
+ :icon="EditPen"
716
+ :disabled="!singleSelectedRow || Boolean(selectedEditRestriction)"
717
+ :plain="!singleSelectedRow || Boolean(selectedEditRestriction)"
718
+ @click="handleSelectedEdit"
719
+ >
720
+ 修改
721
+ </el-button>
722
+ </span>
723
+ </el-tooltip>
724
+ <el-tooltip
725
+ :content="selectedDeleteRestriction || singleSelectionTip"
726
+ placement="top"
727
+ :show-after="200"
728
+ :disabled="selectedRows.length === 1 && !selectedDeleteRestriction"
729
+ >
730
+ <span class="toolbar-action-tooltip">
731
+ <el-button
732
+ size="small"
733
+ type="danger"
734
+ :icon="Delete"
735
+ :disabled="!singleSelectedRow || Boolean(selectedDeleteRestriction)"
736
+ :plain="!singleSelectedRow || Boolean(selectedDeleteRestriction)"
737
+ @click="handleSelectedDelete"
738
+ >
739
+ 删除
740
+ </el-button>
741
+ </span>
742
+ </el-tooltip>
743
+ <el-tooltip
744
+ :content="singleSelectionTip"
745
+ placement="top"
746
+ :show-after="200"
747
+ :disabled="selectedRows.length === 1"
748
+ >
749
+ <span class="toolbar-action-tooltip">
750
+ <el-button
751
+ size="small"
752
+ type="primary"
753
+ :icon="singleSelectedRow?.authirization === '1' ? CircleClose : CircleCheck"
754
+ :loading="Boolean(authorizationActionPredRefNo)"
755
+ :disabled="!singleSelectedRow || Boolean(authorizationActionPredRefNo)"
756
+ :plain="!singleSelectedRow || Boolean(authorizationActionPredRefNo)"
757
+ @click="handleSelectedAuthorization"
758
+ >
759
+ {{ singleSelectedRow?.authirization === '1' ? '取消授权' : '授权' }}
760
+ </el-button>
761
+ </span>
762
+ </el-tooltip>
682
763
  <span class="operation-divider" aria-hidden="true"></span>
683
764
  <el-button size="small" :icon="UploadFilled">导入</el-button>
684
765
  </div>
@@ -720,26 +801,18 @@ onBeforeUnmount(() => {
720
801
  <template #default="{ row }">{{ getOptionLabel(forecastWayOptions, row.predWay) }}</template>
721
802
  </el-table-column>
722
803
  <el-table-column label="预报状态" width="136">
723
- <template #default="{ row }">
724
- <el-tag :type="statusTagType(row.predStatus)" size="small" effect="light">
725
- {{ getOptionLabel(forecastStatusOptions, row.predStatus) }}
726
- </el-tag>
727
- </template>
804
+ <template #default="{ row }">{{ getOptionLabel(forecastStatusOptions, row.predStatus) }}</template>
728
805
  </el-table-column>
729
806
  <el-table-column label="预报类型" width="102">
730
807
  <template #default="{ row }">{{ getOptionLabel(forecastTypeOptions, row.predType) }}</template>
731
808
  </el-table-column>
732
809
  <el-table-column prop="groundBranch" label="落地机构" width="160" show-overflow-tooltip />
733
810
  <el-table-column label="收支方向" width="88">
734
- <template #default="{ row }">
735
- <span class="direction-text" :class="row.payDirection === 'I' ? 'is-income' : 'is-expense'">
736
- {{ getOptionLabel(payDirectionOptions, row.payDirection) }}
737
- </span>
738
- </template>
811
+ <template #default="{ row }">{{ getOptionLabel(payDirectionOptions, row.payDirection) }}</template>
739
812
  </el-table-column>
740
813
  <el-table-column prop="bankAccount" label="账户行" width="188" show-overflow-tooltip />
741
814
  <el-table-column prop="currency" label="币种" width="82">
742
- <template #default="{ row }"><strong class="currency-code">{{ row.currency }}</strong></template>
815
+ <template #default="{ row }">{{ row.currency }}</template>
743
816
  </el-table-column>
744
817
  <el-table-column
745
818
  prop="predAmount"
@@ -753,11 +826,7 @@ onBeforeUnmount(() => {
753
826
  </el-table-column>
754
827
  <el-table-column prop="valueDate" label="起息日" width="116" />
755
828
  <el-table-column label="核销状态" width="108">
756
- <template #default="{ row }">
757
- <el-tag :type="verifyTagType(row.verifyStatus)" size="small" effect="plain">
758
- {{ getOptionLabel(verifyStatusOptions, row.verifyStatus) }}
759
- </el-tag>
760
- </template>
829
+ <template #default="{ row }">{{ getOptionLabel(verifyStatusOptions, row.verifyStatus) }}</template>
761
830
  </el-table-column>
762
831
  <el-table-column prop="verifyAmount" label="核销金额(元)" width="148" align="right">
763
832
  <template #default="{ row }"><span class="money-cell">{{ formatMoney(row.verifyAmount) }}</span></template>
@@ -792,49 +861,6 @@ onBeforeUnmount(() => {
792
861
  >
793
862
  <template #default="{ row }">{{ row.approvalTime || '—' }}</template>
794
863
  </el-table-column>
795
- <el-table-column
796
- column-key="operation"
797
- label="操作"
798
- width="280"
799
- fixed="right"
800
- align="center"
801
- disabled
802
- >
803
- <template #default="{ row }">
804
- <div class="row-actions">
805
- <el-button
806
- link
807
- type="primary"
808
- :icon="EditPen"
809
- :disabled="Boolean(getEditRestriction(row))"
810
- :title="getEditRestriction(row)"
811
- @click.stop="openEditEditor(row)"
812
- >
813
- 修改
814
- </el-button>
815
- <el-button
816
- link
817
- type="danger"
818
- :icon="Delete"
819
- :disabled="Boolean(getDeleteRestriction(row))"
820
- :title="getDeleteRestriction(row)"
821
- @click.stop="handleDelete(row)"
822
- >
823
- 删除
824
- </el-button>
825
- <el-button
826
- link
827
- type="primary"
828
- :icon="row.authirization === '1' ? CircleClose : CircleCheck"
829
- :loading="authorizationActionPredRefNo === row.predRefNo"
830
- :disabled="Boolean(authorizationActionPredRefNo) && authorizationActionPredRefNo !== row.predRefNo"
831
- @click.stop="handleAuthorization(row)"
832
- >
833
- {{ row.authirization === '1' ? '取消授权' : '授权' }}
834
- </el-button>
835
- </div>
836
- </template>
837
- </el-table-column>
838
864
  </ElTablePro>
839
865
  </section>
840
866
 
@@ -865,15 +891,15 @@ onBeforeUnmount(() => {
865
891
  }
866
892
 
867
893
  .query-panel {
868
- margin-bottom: 10px;
869
- padding: 12px 16px 10px;
894
+ margin-bottom: 8px;
895
+ padding: 6px 10px;
870
896
  border-radius: 7px;
871
897
  }
872
898
 
873
899
  .query-grid {
874
900
  display: grid;
875
- grid-template-columns: repeat(6, minmax(0, 1fr));
876
- gap: 8px 12px;
901
+ grid-template-columns: repeat(8, minmax(0, 1fr));
902
+ gap: 3px 6px;
877
903
  }
878
904
 
879
905
  .query-grid.is-collapsed .filter-secondary {
@@ -886,12 +912,12 @@ onBeforeUnmount(() => {
886
912
  }
887
913
 
888
914
  .query-form :deep(.el-form-item__label) {
889
- height: 24px;
915
+ height: 18px;
890
916
  padding: 0;
891
917
  color: #475467;
892
918
  font-size: 12px;
893
919
  font-weight: 600;
894
- line-height: 24px;
920
+ line-height: 18px;
895
921
  }
896
922
 
897
923
  .query-form :deep(.el-input),
@@ -922,15 +948,18 @@ onBeforeUnmount(() => {
922
948
 
923
949
  .query-actions {
924
950
  display: flex;
951
+ grid-column: -3 / -1;
925
952
  justify-content: flex-end;
926
- gap: 8px;
927
- margin-top: 10px;
928
- padding-top: 10px;
929
- border-top: 1px dashed #e2e8f0;
953
+ align-self: end;
954
+ gap: 6px;
930
955
  }
931
956
 
932
957
  .query-actions .el-button {
933
- min-width: 86px;
958
+ min-width: 66px;
959
+ }
960
+
961
+ .query-actions .el-button + .el-button {
962
+ margin-left: 0;
934
963
  }
935
964
 
936
965
  .table-toolbar-actions {
@@ -940,6 +969,10 @@ onBeforeUnmount(() => {
940
969
  flex-wrap: wrap;
941
970
  }
942
971
 
972
+ .toolbar-action-tooltip {
973
+ display: inline-flex;
974
+ }
975
+
943
976
  .table-toolbar-actions .el-button + .el-button {
944
977
  margin-left: 0;
945
978
  }
@@ -1032,7 +1065,8 @@ onBeforeUnmount(() => {
1032
1065
  .forecast-table {
1033
1066
  width: 100%;
1034
1067
  --el-table-header-bg-color: #f3f6fa;
1035
- --el-table-header-text-color: #344054;
1068
+ --el-table-header-text-color: #000;
1069
+ --el-table-text-color: #000;
1036
1070
  --el-table-row-hover-bg-color: #f1f6ff;
1037
1071
  --el-table-border-color: #e1e6ed;
1038
1072
  }
@@ -1075,66 +1109,27 @@ onBeforeUnmount(() => {
1075
1109
  .forecast-table :deep(.el-table__cell) {
1076
1110
  padding: 6px 0;
1077
1111
  font-size: 12px;
1112
+ color: #000;
1078
1113
  }
1079
1114
 
1080
1115
  .forecast-table :deep(.el-table__row) {
1081
1116
  height: 42px;
1082
1117
  }
1083
1118
 
1084
- .forecast-table :deep(.el-tag) {
1085
- max-width: 100%;
1086
- }
1087
-
1088
- .money-cell,
1089
- .currency-code {
1119
+ .money-cell {
1120
+ color: #000;
1090
1121
  font-variant-numeric: tabular-nums;
1091
1122
  }
1092
1123
 
1093
1124
  .money-cell {
1094
- color: #27364f;
1095
1125
  font-weight: 650;
1096
1126
  }
1097
1127
 
1098
- .currency-code {
1099
- color: #174ea6;
1100
- letter-spacing: .03em;
1101
- }
1102
-
1103
- .direction-text {
1104
- font-weight: 700;
1105
- }
1106
-
1107
- .direction-text.is-income,
1108
- .direction-text.is-expense {
1109
- color: var(--page-blue);
1110
- }
1111
-
1112
- .row-actions {
1113
- display: flex;
1114
- align-items: center;
1115
- justify-content: center;
1116
- gap: 8px;
1117
- white-space: nowrap;
1118
- }
1119
-
1120
- .row-actions .el-button {
1121
- width: 78px;
1122
- justify-content: center;
1123
- }
1124
-
1125
- .row-actions .el-button + .el-button {
1126
- margin-left: 0;
1127
- }
1128
-
1129
1128
  @media (max-width: 1380px) {
1130
- .query-grid:not(.is-collapsed) {
1129
+ .query-grid {
1131
1130
  grid-template-columns: repeat(4, minmax(0, 1fr));
1132
1131
  }
1133
1132
 
1134
- .query-grid.is-collapsed {
1135
- grid-template-columns: repeat(6, minmax(0, 1fr));
1136
- }
1137
-
1138
1133
  .operation-bar {
1139
1134
  align-items: flex-start;
1140
1135
  flex-direction: column;
@@ -61,15 +61,21 @@ export const ftuFilterOptions = [
61
61
  ] satisfies SelectOption[]
62
62
 
63
63
  export const currencyOptions = [
64
- { value: 'USD', label: 'USD 美元' },
65
- { value: 'EUR', label: 'EUR 欧元' },
66
- { value: 'HKD', label: 'HKD 港币' },
67
- { value: 'JPY', label: 'JPY 日元' },
68
- { value: 'GBP', label: 'GBP 英镑' },
69
- { value: 'SGD', label: 'SGD 新加坡元' },
70
- { value: 'AUD', label: 'AUD 澳元' },
71
- { value: 'CAD', label: 'CAD 加拿大元' },
72
- { value: 'CHF', label: 'CHF 瑞士法郎' },
64
+ { value: 'CNY', label: 'CNY-人民币' },
65
+ { value: 'USD', label: 'USD-美元' },
66
+ { value: 'HKD', label: 'HKD-港元' },
67
+ { value: 'EUR', label: 'EUR-欧元' },
68
+ { value: 'AUD', label: 'AUD-澳大利亚元' },
69
+ { value: 'CHF', label: 'CHF-瑞士法郎' },
70
+ { value: 'GBP', label: 'GBP-英镑' },
71
+ { value: 'CAD', label: 'CAD-加拿大元' },
72
+ { value: 'NZD', label: 'NZD-新西兰元' },
73
+ { value: 'SGD', label: 'SGD-新加坡元' },
74
+ { value: 'JPY', label: 'JPY-日元' },
75
+ { value: 'SEK', label: 'SEK-瑞典克朗' },
76
+ { value: 'NOK', label: 'NOK-挪威克朗' },
77
+ { value: 'DKK', label: 'DKK-丹麦克朗' },
78
+ { value: 'KZT', label: 'KZT-哈萨克斯坦坚戈' },
73
79
  ] satisfies SelectOption[]
74
80
 
75
81
  export const clientTypeOptions = [
@@ -48,7 +48,7 @@ export const useForeignPositionForecastStore = defineStore(
48
48
  const selectionResetKey = ref(0)
49
49
  const isLoading = ref(false)
50
50
  const isQuerying = ref(false)
51
- const filterCollapsed = ref(true)
51
+ const filterCollapsed = ref(false)
52
52
  const currentPage = ref(1)
53
53
  const pageSize = ref(25)
54
54
  const successfulPage = ref(1)
@@ -14,7 +14,7 @@ import {
14
14
  ref,
15
15
  watch,
16
16
  } from 'vue'
17
- import { Check, Search } from '@element-plus/icons-vue'
17
+ import { Check } from '@element-plus/icons-vue'
18
18
  import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
19
19
 
20
20
  import {
@@ -39,11 +39,11 @@ import {
39
39
  payDirectionOptions,
40
40
  requiresCustomerAccountQuery,
41
41
  toRmbPositionCustomerAccountSequence,
42
- toRmbPositionOrganizationOptions,
42
+ toRmbPositionOrganizationCascaderOptions,
43
43
  type EditorControlledField,
44
44
  type EditorForm,
45
45
  type RmbPositionForecastMutationValue,
46
- type RmbPositionOrganizationOption,
46
+ type RmbPositionOrganizationCascaderOption,
47
47
  } from '../model'
48
48
  import {
49
49
  getLocalDateString,
@@ -95,12 +95,29 @@ let editorSessionId = 0
95
95
  const isClientAccountQuerying = ref(false)
96
96
  let clientAccountQueryController: AbortController | null = null
97
97
 
98
- /** 落地机构搜索结果及其请求状态。 */
99
- const organizationSearchVisible = ref(false)
100
- const organizationSearchOptions = ref<RmbPositionOrganizationOption[]>([])
101
- const organizationSearchResultsRef = ref<HTMLElement>()
102
- const isOrganizationSearching = ref(false)
103
- let organizationSearchController: AbortController | null = null
98
+ /** 落地机构级联树及其请求状态。 */
99
+ const organizationCascaderOptions = ref<RmbPositionOrganizationCascaderOption[]>([])
100
+ const isOrganizationTreeLoading = ref(false)
101
+ const hasOrganizationTreeLoaded = ref(false)
102
+ let organizationTreeController: AbortController | null = null
103
+ const organizationCascaderProps = {
104
+ checkStrictly: true,
105
+ emitPath: false,
106
+ }
107
+ /** 机构树尚未加载或未包含环境默认机构时,仍使用当前名称和代码正确回显。 */
108
+ const displayedOrganizationCascaderOptions = computed(() => {
109
+ const options = organizationCascaderOptions.value
110
+ const currentCode = form.groundBranchCode.trim()
111
+ if (!currentCode || findOrganizationOption(options, currentCode)) return options
112
+
113
+ const currentName = form.groundBranch.trim() || currentCode
114
+ return [{
115
+ value: currentCode,
116
+ label: currentName,
117
+ organizationCode: currentCode,
118
+ organizationName: currentName,
119
+ }, ...options]
120
+ })
104
121
 
105
122
  /** 新增只展示可选客户类型,修改则保留旧协议的“不适用”编码。 */
106
123
  const clientTypeOptionsForEditor = computed(() => {
@@ -151,7 +168,7 @@ const focusOrder = computed(() => {
151
168
 
152
169
  const billBusiness = isBillBusinessType(form.businessType)
153
170
  const accountingCenter = isAccountingCenter(form.groundBranchCode)
154
- const order = ['businessType', 'groundBranch', 'groundBranchSearch']
171
+ const order = ['businessType', 'groundBranch']
155
172
 
156
173
  if (billBusiness) {
157
174
  order.push('billNo', 'billDate')
@@ -350,13 +367,11 @@ function resetClientSelection() {
350
367
  form.customerInfoSequence = ''
351
368
  }
352
369
 
353
- /** 取消机构搜索并关闭结果浮层。 */
354
- function resetOrganizationSearch() {
355
- organizationSearchController?.abort()
356
- organizationSearchController = null
357
- organizationSearchOptions.value = []
358
- organizationSearchVisible.value = false
359
- isOrganizationSearching.value = false
370
+ /** 取消仍在进行的机构树请求,已加载的树继续复用。 */
371
+ function resetOrganizationTreeRequest() {
372
+ organizationTreeController?.abort()
373
+ organizationTreeController = null
374
+ isOrganizationTreeLoading.value = false
360
375
  }
361
376
 
362
377
  /** 清空客户及其查询流水号,供业务类型/机构/客户类型切换复用。 */
@@ -392,7 +407,7 @@ function assignForm() {
392
407
  Object.assign(form, createEditorForm(getEditorContext(), props.sourceRecord, props.mode))
393
408
  syncAmountText()
394
409
  resetClientSelection()
395
- resetOrganizationSearch()
410
+ resetOrganizationTreeRequest()
396
411
  if (props.mode !== 'edit') normalizeCreateEditorForm(form, fieldPolicy.value)
397
412
  clearValidation()
398
413
  }
@@ -407,86 +422,78 @@ function handleBusinessTypeChange() {
407
422
  normalizeCreateLinkage()
408
423
  }
409
424
 
410
- /** 机构名称变更后先清空机构代码及所有下游联动,再等待重新选择机构。 */
411
- function handleGroundBranchNameChange() {
412
- if (props.mode === 'edit') return
413
- form.groundBranch = form.groundBranch.trim()
414
- form.groundBranchCode = ''
415
- clearCustomerFields()
416
- clearCounterpartyFields()
417
- clearBillFields()
418
- form.payChannel = ''
419
- resetOrganizationSearch()
420
- normalizeCreateLinkage()
425
+ /** 按机构代码递归查找级联节点,用于回填提交所需的机构名称。 */
426
+ function findOrganizationOption(
427
+ options: RmbPositionOrganizationCascaderOption[],
428
+ organizationCode: string,
429
+ ): RmbPositionOrganizationCascaderOption | undefined {
430
+ for (const option of options) {
431
+ if (option.organizationCode === organizationCode) return option
432
+ const child = option.children
433
+ ? findOrganizationOption(option.children, organizationCode)
434
+ : undefined
435
+ if (child) return child
436
+ }
437
+ return undefined
421
438
  }
422
439
 
423
- /** 用户手工修改已解析的机构名称时立即使旧机构代码和下游值失效。 */
424
- function handleGroundBranchNameInput() {
425
- if (props.mode === 'edit') return
426
- organizationSearchController?.abort()
427
- organizationSearchController = null
428
- organizationSearchOptions.value = []
429
- organizationSearchVisible.value = false
430
- isOrganizationSearching.value = false
431
- if (!form.groundBranchCode) return
432
-
433
- form.groundBranchCode = ''
434
- clearCustomerFields()
435
- clearCounterpartyFields()
436
- clearBillFields()
437
- form.payChannel = ''
438
- normalizeCreateLinkage()
440
+ /** el-cascader 的搜索同时匹配机构名称和机构代码。 */
441
+ function filterOrganizationNode(node: any, keyword: string) {
442
+ const option = node?.data as RmbPositionOrganizationCascaderOption | undefined
443
+ const normalizedKeyword = keyword.trim().toLocaleLowerCase('zh-CN')
444
+ return Boolean(option && (
445
+ option.organizationName.toLocaleLowerCase('zh-CN').includes(normalizedKeyword)
446
+ || option.organizationCode.toLocaleLowerCase('zh-CN').includes(normalizedKeyword)
447
+ ))
439
448
  }
440
449
 
441
- /** 查询 UAA 机构树并按名称/代码筛选,只有最后一次搜索可以更新结果。 */
442
- async function handleOrganizationSearch() {
443
- const keyword = form.groundBranch.trim()
444
- if (!keyword) {
445
- ElMessage.warning('机构名称不能为空')
446
- return
447
- }
450
+ /** 首次展开级联面板时加载完整 UAA 机构树,后续打开复用同一份数据。 */
451
+ async function loadOrganizationTree() {
452
+ if (hasOrganizationTreeLoaded.value || isOrganizationTreeLoading.value) return
448
453
 
449
- organizationSearchController?.abort()
454
+ organizationTreeController?.abort()
450
455
  const controller = new AbortController()
451
- organizationSearchController = controller
452
- organizationSearchVisible.value = false
453
- isOrganizationSearching.value = true
456
+ organizationTreeController = controller
457
+ isOrganizationTreeLoading.value = true
454
458
 
455
459
  try {
456
460
  const response = await queryRmbPositionOrganizationTree() as any
457
- if (controller.signal.aborted || organizationSearchController !== controller) return
458
- const options = toRmbPositionOrganizationOptions(response.data, keyword)
461
+ if (controller.signal.aborted || organizationTreeController !== controller) return
462
+ const options = toRmbPositionOrganizationCascaderOptions(response.data)
459
463
 
460
- organizationSearchOptions.value = options
461
- organizationSearchVisible.value = options.length > 0
464
+ organizationCascaderOptions.value = options
465
+ hasOrganizationTreeLoaded.value = true
462
466
  if (options.length === 0) {
463
- ElMessage.info('未查询到匹配的落地机构')
464
- } else {
465
- await nextTick()
466
- organizationSearchResultsRef.value?.querySelector<HTMLElement>('button')?.focus()
467
+ ElMessage.info('未查询到可用的落地机构')
467
468
  }
468
469
  } catch (error) {
469
470
  if (controller.signal.aborted) return
470
- ElMessage.error(error instanceof Error ? error.message : '落地机构查询失败')
471
+ ElMessage.error(error instanceof Error ? error.message : '落地机构树加载失败')
471
472
  } finally {
472
- if (organizationSearchController === controller) {
473
- organizationSearchController = null
474
- isOrganizationSearching.value = false
473
+ if (organizationTreeController === controller) {
474
+ organizationTreeController = null
475
+ isOrganizationTreeLoading.value = false
475
476
  }
476
477
  }
477
478
  }
478
479
 
479
- /** 回填机构名称和代码后重新计算所有业务联动,并把焦点移到下一个字段。 */
480
- function selectOrganization(option: RmbPositionOrganizationOption) {
481
- form.groundBranch = option.organizationName
482
- form.groundBranchCode = option.organizationCode
480
+ function handleOrganizationCascaderVisibleChange(visible: boolean) {
481
+ if (visible) void loadOrganizationTree()
482
+ }
483
+
484
+ /** 级联选中后回填机构名称和代码,并保持原新增/复制联动清理逻辑。 */
485
+ function handleGroundBranchChange(value: unknown) {
486
+ if (props.mode === 'edit') return
487
+ const organizationCode = String(Array.isArray(value) ? value.at(-1) ?? '' : value ?? '').trim()
488
+ const option = findOrganizationOption(displayedOrganizationCascaderOptions.value, organizationCode)
489
+ form.groundBranchCode = organizationCode
490
+ form.groundBranch = option?.organizationName ?? ''
483
491
  clearCustomerFields()
484
492
  clearCounterpartyFields()
485
493
  clearBillFields()
486
494
  form.payChannel = ''
487
- organizationSearchVisible.value = false
488
495
  normalizeCreateLinkage()
489
- focusNextField('groundBranchSearch')
496
+ if (organizationCode) nextTick(() => focusNextField('groundBranch'))
490
497
  }
491
498
 
492
499
  /** 新增/复制切换客户类型会清空支付渠道、客户查询和交易对手,要求重新选择。 */
@@ -728,7 +735,7 @@ watch(
728
735
  onBeforeUnmount(() => {
729
736
  editorSessionId += 1
730
737
  clientAccountQueryController?.abort()
731
- organizationSearchController?.abort()
738
+ organizationTreeController?.abort()
732
739
  })
733
740
  </script>
734
741
 
@@ -748,7 +755,6 @@ onBeforeUnmount(() => {
748
755
  :validate-on-rule-change="false"
749
756
  label-position="right"
750
757
  label-width="112px"
751
- size="small"
752
758
  class="editor-form"
753
759
  @submit.prevent
754
760
  @keydown.enter.capture="handleEnter"
@@ -774,46 +780,26 @@ onBeforeUnmount(() => {
774
780
  </el-form-item>
775
781
 
776
782
  <el-form-item label="落地机构" prop="groundBranch" data-editor-field="groundBranch">
777
- <div class="control-with-action">
778
- <el-input
779
- v-model="form.groundBranch"
780
- :disabled="isFieldDisabled('groundBranch')"
781
- maxlength="80"
782
- placeholder="请输入机构名称"
783
- @input="handleGroundBranchNameInput"
784
- @change="handleGroundBranchNameChange"
785
- />
786
- <el-popover
787
- v-if="mode !== 'edit'"
788
- v-model:visible="organizationSearchVisible"
789
- :width="420"
790
- placement="bottom-end"
791
- trigger="click"
792
- >
793
- <div ref="organizationSearchResultsRef" class="client-search-results">
794
- <button
795
- v-for="option in organizationSearchOptions"
796
- :key="option.organizationCode"
797
- type="button"
798
- class="client-search-option"
799
- @click="selectOrganization(option)"
800
- >
801
- <span>{{ option.organizationName }}</span>
802
- <small>{{ option.organizationCode }}</small>
803
- </button>
804
- </div>
805
- <template #reference>
806
- <el-button
807
- data-editor-focus="groundBranchSearch"
808
- :icon="Search"
809
- :loading="isOrganizationSearching"
810
- @click="handleOrganizationSearch"
811
- >
812
- 查询
813
- </el-button>
814
- </template>
815
- </el-popover>
816
- </div>
783
+ <el-cascader
784
+ v-model="form.groundBranchCode"
785
+ data-editor-focus="groundBranch"
786
+ class="organization-cascader"
787
+ :options="displayedOrganizationCascaderOptions"
788
+ :props="organizationCascaderProps"
789
+ :disabled="isFieldDisabled('groundBranch')"
790
+ :placeholder="isOrganizationTreeLoading ? '正在加载机构…' : '请选择落地机构'"
791
+ :filter-method="filterOrganizationNode"
792
+ :show-all-levels="false"
793
+ clearable
794
+ filterable
795
+ @visible-change="handleOrganizationCascaderVisibleChange"
796
+ @change="handleGroundBranchChange"
797
+ >
798
+ <template #default="{ data }">
799
+ <span>{{ data.organizationName }}</span>
800
+ <small class="organization-cascader-code">{{ data.organizationCode }}</small>
801
+ </template>
802
+ </el-cascader>
817
803
  </el-form-item>
818
804
 
819
805
  <el-form-item label="交易日期" prop="tradeDate" data-editor-field="tradeDate">
@@ -945,10 +931,6 @@ onBeforeUnmount(() => {
945
931
  />
946
932
  </el-form-item>
947
933
 
948
- <el-form-item label="标准名称" class="editor-full-row">
949
- <el-input v-model="form.standardName" disabled placeholder="由详情接口返回" />
950
- </el-form-item>
951
-
952
934
  </div>
953
935
  </section>
954
936
 
@@ -1132,6 +1114,7 @@ onBeforeUnmount(() => {
1132
1114
  }
1133
1115
 
1134
1116
  .editor-form :deep(.el-input),
1117
+ .editor-form :deep(.el-cascader),
1135
1118
  .editor-form :deep(.el-select),
1136
1119
  .editor-form :deep(.el-date-editor),
1137
1120
  .editor-form :deep(.el-input-number) {
@@ -1248,41 +1231,10 @@ onBeforeUnmount(() => {
1248
1231
  color: #12805c;
1249
1232
  }
1250
1233
 
1251
- .client-search-results {
1252
- display: flex;
1253
- max-height: 260px;
1254
- overflow-y: auto;
1255
- flex-direction: column;
1256
- gap: 5px;
1257
- }
1258
-
1259
- .client-search-option {
1260
- display: flex;
1261
- align-items: center;
1262
- justify-content: space-between;
1263
- width: 100%;
1264
- gap: 12px;
1265
- padding: 9px 10px;
1266
- border: 0;
1267
- border-radius: 5px;
1268
- background: #f7f9fc;
1269
- color: #27364f;
1270
- cursor: pointer;
1271
- font: inherit;
1272
- text-align: left;
1273
- }
1274
-
1275
- .client-search-option:hover,
1276
- .client-search-option:focus-visible {
1277
- outline: none;
1278
- background: #eaf2ff;
1279
- color: var(--editor-blue);
1280
- }
1281
-
1282
- .client-search-option small {
1283
- color: #667085;
1234
+ .organization-cascader-code {
1235
+ margin-left: 8px;
1236
+ color: #7b8798;
1284
1237
  font-size: 11px;
1285
- text-align: right;
1286
1238
  }
1287
1239
 
1288
1240
  .editor-actions {
@@ -136,7 +136,7 @@ onBeforeUnmount(() => {
136
136
  <!-- @vue-skip -->
137
137
  <main class="rmb-forecast-detail-page">
138
138
  <section class="detail-page-heading">
139
- <el-button class="back-button" size="small" :icon="ArrowLeft" @click="returnToList">
139
+ <el-button class="back-button" :icon="ArrowLeft" @click="returnToList">
140
140
  返回
141
141
  </el-button>
142
142
  <div class="heading-copy">
@@ -151,7 +151,6 @@ onBeforeUnmount(() => {
151
151
  <span>预报状态</span>
152
152
  <el-tag
153
153
  :type="forecastStatusTagType(detailRecord.predStatus)"
154
- size="small"
155
154
  effect="light"
156
155
  >
157
156
  {{ getOptionLabel(forecastStatusOptions, detailRecord.predStatus) }}
@@ -200,7 +199,7 @@ onBeforeUnmount(() => {
200
199
  <div class="detail-item" data-detail-field="verifyStatus">
201
200
  <dt>核销状态</dt>
202
201
  <dd>
203
- <el-tag :type="verifyStatusTagType(detailRecord.verifyStatus)" size="small" effect="plain">
202
+ <el-tag :type="verifyStatusTagType(detailRecord.verifyStatus)" effect="plain">
204
203
  {{ getOptionLabel(verifyStatusOptions, detailRecord.verifyStatus) }}
205
204
  </el-tag>
206
205
  </dd>
@@ -159,7 +159,6 @@ onBeforeUnmount(() => {
159
159
  <section class="form-page-heading">
160
160
  <el-button
161
161
  class="back-button"
162
- size="small"
163
162
  :icon="ArrowLeft"
164
163
  :disabled="isSubmitting"
165
164
  @click="returnToList"
@@ -654,7 +654,6 @@ function handleExport() {
654
654
  row-key="predRefNo"
655
655
  border
656
656
  stripe
657
- :fit="false"
658
657
  :height="tableHeight"
659
658
  empty-text="暂无人民币头寸预报记录"
660
659
  class="forecast-table"
@@ -1006,18 +1005,7 @@ function handleExport() {
1006
1005
  }
1007
1006
 
1008
1007
  .forecast-table :deep(.cell) {
1009
- overflow: visible;
1010
- text-overflow: clip;
1011
1008
  white-space: nowrap;
1012
- word-break: normal;
1013
- }
1014
-
1015
- /* 列宽按内容自然展开,超出页面宽度时由表格内部横向滚动承载。 */
1016
- .forecast-table :deep(.el-table__inner-wrapper > .el-table__body-wrapper .el-table__body),
1017
- .forecast-table :deep(.el-table__inner-wrapper > .el-table__header-wrapper .el-table__header),
1018
- .forecast-table :deep(.el-table__inner-wrapper > .el-table__footer-wrapper .el-table__footer) {
1019
- width: max-content !important;
1020
- min-width: 100%;
1021
1009
  }
1022
1010
 
1023
1011
  .forecast-table :deep(.el-table__row) {
@@ -132,6 +132,13 @@ export type RmbPositionOrganizationOption = {
132
132
  organizationName: string
133
133
  }
134
134
 
135
+ /** Element Plus Cascader 使用的机构树节点,同时保留提交所需的机构名称和代码。 */
136
+ export type RmbPositionOrganizationCascaderOption = RmbPositionOrganizationOption & {
137
+ value: string
138
+ label: string
139
+ children?: RmbPositionOrganizationCascaderOption[]
140
+ }
141
+
135
142
  /** 140101001 需要的旧 JSP/TAM 查询字段。金额字段传元的字符串。 */
136
143
  export type RmbPositionForecastQueryParams = {
137
144
  busiType: string
@@ -258,7 +265,6 @@ export type EditorForm = {
258
265
  customerReferenceSequence: string
259
266
  counterpartyName: string
260
267
  counterpartyAccount: string
261
- standardName: string
262
268
  businessType: string
263
269
  billNo: string
264
270
  billDate: string
@@ -346,7 +352,6 @@ export function createEditorForm(
346
352
  : '',
347
353
  counterpartyName: String(row?.counterpartyName ?? ''),
348
354
  counterpartyAccount: String(row?.counterpartyAccount ?? ''),
349
- standardName: String(row?.standardName ?? ''),
350
355
  businessType: String(row?.businessType ?? ''),
351
356
  billNo: String(row?.billNo ?? ''),
352
357
  billDate: String(row?.billDate ?? ''),
@@ -390,7 +395,6 @@ export function createEditorFieldPolicy(
390
395
  payDirection: 'disabled',
391
396
  predAmount: editAmountAndDateLocked ? 'disabled' : 'required',
392
397
  tradeDate: editAmountAndDateLocked ? 'disabled' : 'required',
393
- standardName: 'disabled',
394
398
  }
395
399
  }
396
400
 
@@ -418,7 +422,6 @@ export function createEditorFieldPolicy(
418
422
  payDirection: 'required',
419
423
  predAmount: 'required',
420
424
  tradeDate: 'required',
421
- standardName: 'disabled',
422
425
  }
423
426
  }
424
427
 
@@ -836,3 +839,46 @@ export function toRmbPositionOrganizationOptions(
836
839
  || option.organizationCode.toLocaleLowerCase('zh-CN').includes(normalizedKeyword)
837
840
  )).slice(0, 20)
838
841
  }
842
+
843
+ /** 将 UAA 机构树转换为 Cascader 层级选项;无有效机构信息的虚拟根节点会被自动展开。 */
844
+ function createOrganizationCascaderOptions(
845
+ node: unknown,
846
+ seenCodes: Set<string>,
847
+ ): RmbPositionOrganizationCascaderOption[] {
848
+ if (Array.isArray(node)) {
849
+ return node.flatMap((item) => createOrganizationCascaderOptions(item, seenCodes))
850
+ }
851
+ if (!node || typeof node !== 'object') return []
852
+
853
+ const current = toProtocolRecord(node)
854
+ const attributes = toProtocolRecord(current.attributes)
855
+ const organizationCode = String(
856
+ attributes.orgNo ?? attributes.orgId ?? current.id ?? '',
857
+ ).trim()
858
+ const organizationName = String(attributes.orgName ?? current.text ?? '').trim()
859
+ const children = createOrganizationCascaderOptions(current.children, seenCodes)
860
+ const isSelectableOrganization = Boolean(
861
+ organizationCode
862
+ && organizationCode !== '-1'
863
+ && organizationName
864
+ && !seenCodes.has(organizationCode),
865
+ )
866
+
867
+ if (!isSelectableOrganization) return children
868
+
869
+ seenCodes.add(organizationCode)
870
+ return [{
871
+ value: organizationCode,
872
+ label: organizationName,
873
+ organizationCode,
874
+ organizationName,
875
+ ...(children.length > 0 ? { children } : {}),
876
+ }]
877
+ }
878
+
879
+ /** 保留机构父子层级供 el-cascader 展示和内置过滤。 */
880
+ export function toRmbPositionOrganizationCascaderOptions(
881
+ tree: unknown,
882
+ ): RmbPositionOrganizationCascaderOption[] {
883
+ return createOrganizationCascaderOptions(tree, new Set<string>())
884
+ }