verce-vue-test 0.0.137 → 0.0.139

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.137",
3
+ "version": "0.0.139",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -48,6 +48,7 @@ import {
48
48
  amountColumnProps,
49
49
  businessTypeOptions,
50
50
  channelOptions,
51
+ clientTypeMap,
51
52
  createDefaultFlowForm,
52
53
  createDefaultForecastForm,
53
54
  flowColumns,
@@ -114,6 +115,12 @@ const isCurrentRoute = computed(() => !ownerRouteRecord || route.matched.include
114
115
  const overlayContainerId = `forecast-info-overlay-host-${getCurrentInstance()?.uid ?? 0}`
115
116
  const overlayContainerSelector = `#${overlayContainerId}`
116
117
 
118
+ /** 将人民币预报客户类型编码转换为列表显示文案。 */
119
+ function formatClientType(value: unknown) {
120
+ const code = String(value ?? '').trim()
121
+ return clientTypeMap[code] ?? (code || '-')
122
+ }
123
+
117
124
  /**
118
125
  * 页面专属的浮层挂载点。
119
126
  * 抽屉和弹窗不再直接挂到 body,避免 Layout 路由切换或 KeepAlive 缓存时遮罩残留在其他页面上。
@@ -797,6 +804,7 @@ onBeforeUnmount(() => {
797
804
  stripe
798
805
  size="small"
799
806
  colBtnSize="small"
807
+ :fit="false"
800
808
  table-layout="auto"
801
809
  height="100%"
802
810
  class="forecast-info-table forecast-info-table--forecast"
@@ -874,6 +882,9 @@ onBeforeUnmount(() => {
874
882
  <template v-else-if="column.prop === 'relsFlag'" #default="{ row }">
875
883
  {{ releaseStatusMap[String(row.relsFlag)] ?? row.relsFlag ?? '-' }}
876
884
  </template>
885
+ <template v-else-if="column.prop === 'clientType'" #default="{ row }">
886
+ {{ formatClientType(row.clientType) }}
887
+ </template>
877
888
  </el-table-column>
878
889
  <!-- 已核销且核销金额大于预报金额时才展示修改入口。 -->
879
890
  <el-table-column
@@ -1330,6 +1341,7 @@ onBeforeUnmount(() => {
1330
1341
  stripe
1331
1342
  size="small"
1332
1343
  colBtnSize="small"
1344
+ :fit="false"
1333
1345
  table-layout="auto"
1334
1346
  height="100%"
1335
1347
  class="forecast-info-table forecast-info-table--flow"
@@ -91,6 +91,13 @@ export const forecastVerifyStatusMap: Record<string, string> = Object.fromEntrie
91
91
  forecastVerifyStatusOptions.map((option) => [option.value, option.label]),
92
92
  )
93
93
 
94
+ /** 人民币预报列表客户类型显示文案。 */
95
+ export const clientTypeMap: Record<string, string> = {
96
+ '1': '对公客户',
97
+ '2': '个人客户',
98
+ '5': '其他',
99
+ }
100
+
94
101
  export const amountColumnProps = new Set(['predAmt', 'verifyAmt'])
95
102
 
96
103
  /** 预报信息表格列。 */
@@ -468,6 +468,14 @@
468
468
  word-break: normal;
469
469
  }
470
470
 
471
+ /* 列宽由内容决定,超出卡片时交由表格内部横向滚动,避免单元格被截断。 */
472
+ .forecast-info-page[data-page-scope="rmb-position-settlement-forecast-info"] .forecast-info-table > .el-table__inner-wrapper > .el-table__body-wrapper .el-table__body,
473
+ .forecast-info-page[data-page-scope="rmb-position-settlement-forecast-info"] .forecast-info-table > .el-table__inner-wrapper > .el-table__header-wrapper .el-table__header,
474
+ .forecast-info-page[data-page-scope="rmb-position-settlement-forecast-info"] .forecast-info-table > .el-table__inner-wrapper > .el-table__footer-wrapper .el-table__footer {
475
+ width: max-content !important;
476
+ min-width: 100%;
477
+ }
478
+
471
479
  .forecast-info-page[data-page-scope="rmb-position-settlement-forecast-info"] .forecast-info-table .el-table__empty-block {
472
480
  min-height: 86px;
473
481
  }
@@ -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 {
@@ -12,7 +12,7 @@ import { ElMessage } from 'element-plus'
12
12
  import { getRmbPositionForecastDetail } from './api'
13
13
  import {
14
14
  businessTypeOptions,
15
- clientTypeOptions,
15
+ formatRmbPositionClientType,
16
16
  formatChineseCurrency,
17
17
  forecastStatusOptions,
18
18
  payChannelOptions,
@@ -50,7 +50,7 @@ function getOptionLabel(options: SelectOption[], value: string) {
50
50
  /** 详情页将旧协议的 3、4 客户类型统一展示为“不适用”。 */
51
51
  function getClientTypeLabel(value: string) {
52
52
  if (value === '3' || value === '4') return '不适用'
53
- return getOptionLabel(clientTypeOptions, value)
53
+ return formatRmbPositionClientType(value)
54
54
  }
55
55
 
56
56
  /** 详情金额按元展示两位小数;该函数只负责显示格式化。 */
@@ -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"
@@ -38,6 +38,7 @@ import {
38
38
  createRmbPositionForecastDeleteParams,
39
39
  createRmbPositionForecastQueryParams,
40
40
  deleteStatusOptions,
41
+ formatRmbPositionClientType,
41
42
  forecastStatusOptions,
42
43
  payChannelOptions,
43
44
  payDirectionOptions,
@@ -224,6 +225,7 @@ function getTableColumnText(
224
225
  const value = (row as any)[column.prop]
225
226
  if (column.render === 'date') return formatCompactDate(String(value ?? ''))
226
227
  if (column.render === 'money') return formatMoney(Number(value ?? 0))
228
+ if (column.prop === 'clientType') return formatRmbPositionClientType(value)
227
229
  if (column.options) return getOptionLabel(column.options, String(value ?? ''))
228
230
  return String(value ?? '') || '—'
229
231
  }
@@ -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
@@ -197,6 +204,19 @@ export const clientTypeOptions = [
197
204
  { value: '5', label: '其他' },
198
205
  ] satisfies SelectOption<RmbPositionClientType>[]
199
206
 
207
+ /** 将列表和详情中的客户类型编码转换为展示文案,不改变接口提交值。 */
208
+ const clientTypeLabels: Record<string, string> = {
209
+ '1': '对公客户',
210
+ '2': '个人客户',
211
+ '5': '其他',
212
+ }
213
+
214
+ export function formatRmbPositionClientType(value: unknown) {
215
+ const code = String(value ?? '').trim()
216
+ const label = clientTypeLabels[code]
217
+ return label || code || '—'
218
+ }
219
+
200
220
  /** 业务类型选项;编码必须与旧 JSP/TAM 约定保持一致。 */
201
221
  export const businessTypeOptions = [
202
222
  { value: '1', label: '对公/个人客户收付' },
@@ -245,7 +265,6 @@ export type EditorForm = {
245
265
  customerReferenceSequence: string
246
266
  counterpartyName: string
247
267
  counterpartyAccount: string
248
- standardName: string
249
268
  businessType: string
250
269
  billNo: string
251
270
  billDate: string
@@ -333,7 +352,6 @@ export function createEditorForm(
333
352
  : '',
334
353
  counterpartyName: String(row?.counterpartyName ?? ''),
335
354
  counterpartyAccount: String(row?.counterpartyAccount ?? ''),
336
- standardName: String(row?.standardName ?? ''),
337
355
  businessType: String(row?.businessType ?? ''),
338
356
  billNo: String(row?.billNo ?? ''),
339
357
  billDate: String(row?.billDate ?? ''),
@@ -377,7 +395,6 @@ export function createEditorFieldPolicy(
377
395
  payDirection: 'disabled',
378
396
  predAmount: editAmountAndDateLocked ? 'disabled' : 'required',
379
397
  tradeDate: editAmountAndDateLocked ? 'disabled' : 'required',
380
- standardName: 'disabled',
381
398
  }
382
399
  }
383
400
 
@@ -405,7 +422,6 @@ export function createEditorFieldPolicy(
405
422
  payDirection: 'required',
406
423
  predAmount: 'required',
407
424
  tradeDate: 'required',
408
- standardName: 'disabled',
409
425
  }
410
426
  }
411
427
 
@@ -823,3 +839,46 @@ export function toRmbPositionOrganizationOptions(
823
839
  || option.organizationCode.toLocaleLowerCase('zh-CN').includes(normalizedKeyword)
824
840
  )).slice(0, 20)
825
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
+ }