vue3-element-plus-app-chu 0.0.23 → 0.0.24
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 +1 -1
- package/src/router/index.ts +0 -30
- package/src/view/dcps/forecast/index.vue +24 -28
package/package.json
CHANGED
package/src/router/index.ts
CHANGED
|
@@ -29,36 +29,6 @@ const routes: RouteRecordRaw[] = [
|
|
|
29
29
|
component: DigitalRmbForecast,
|
|
30
30
|
meta: { menu: 'forecast', title: '数字人民币头寸预报' },
|
|
31
31
|
},
|
|
32
|
-
{
|
|
33
|
-
path: 'forecast/create',
|
|
34
|
-
name: 'forecast-create',
|
|
35
|
-
component: DigitalRmbForecast,
|
|
36
|
-
meta: { menu: 'forecast', title: '新增数字人民币头寸预报' },
|
|
37
|
-
props: (route) => ({
|
|
38
|
-
mode: 'create',
|
|
39
|
-
tranDate: typeof route.query.tranDate === 'string' ? route.query.tranDate : undefined,
|
|
40
|
-
}),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
path: 'forecast/:predRefNo/edit',
|
|
44
|
-
name: 'forecast-edit',
|
|
45
|
-
component: DigitalRmbForecast,
|
|
46
|
-
meta: { menu: 'forecast', title: '修改数字人民币头寸预报' },
|
|
47
|
-
props: (route) => ({
|
|
48
|
-
mode: 'edit',
|
|
49
|
-
predRefNo: String(route.params.predRefNo ?? ''),
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
path: 'forecast/:predRefNo',
|
|
54
|
-
name: 'forecast-detail',
|
|
55
|
-
component: DigitalRmbForecast,
|
|
56
|
-
meta: { menu: 'forecast', title: '数字人民币头寸预报详情' },
|
|
57
|
-
props: (route) => ({
|
|
58
|
-
mode: 'detail',
|
|
59
|
-
predRefNo: String(route.params.predRefNo ?? ''),
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
32
|
{
|
|
63
33
|
path: 'estimation',
|
|
64
34
|
name: 'estimation',
|
|
@@ -21,7 +21,6 @@ const recallForecastRow = (predRefNo?: string): ForecastRowType | null => {
|
|
|
21
21
|
|
|
22
22
|
<script setup lang="ts">
|
|
23
23
|
import { computed, onActivated, onBeforeUnmount, reactive, ref, watch } from 'vue'
|
|
24
|
-
import { useRouter } from 'vue-router'
|
|
25
24
|
import { ElConfigProvider, ElMessage, ElMessageBox } from 'element-plus'
|
|
26
25
|
import API from './api'
|
|
27
26
|
import { dcpsRuntime } from '../runtime'
|
|
@@ -41,17 +40,8 @@ defineOptions({ name: 'DcpsForecastPage' })
|
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
42
|
* 预报页面:列表、新增/修改、详情共用一个入口文件。
|
|
44
|
-
*
|
|
43
|
+
* 新增/修改/详情直接在当前页面以对话框打开,不跳转新页面。
|
|
45
44
|
*/
|
|
46
|
-
const props = defineProps<{
|
|
47
|
-
mode?: 'create' | 'edit' | 'detail' // 页面形态;缺省为列表页。
|
|
48
|
-
predRefNo?: string // 修改、详情模式的预报流水号,来自路由参数。
|
|
49
|
-
tranDate?: string // 新增模式的默认交易日期,格式为 YYYYMMDD。
|
|
50
|
-
}>()
|
|
51
|
-
|
|
52
|
-
const router = useRouter()
|
|
53
|
-
const isEditor = computed(() => props.mode === 'create' || props.mode === 'edit')
|
|
54
|
-
const isDetail = computed(() => props.mode === 'detail')
|
|
55
45
|
|
|
56
46
|
// ---------- 页面内工具函数 ----------
|
|
57
47
|
|
|
@@ -243,6 +233,13 @@ const listBusy = computed(() => listMutation.value !== null)
|
|
|
243
233
|
const listTableRef = ref<InstanceType<typeof ArtDataTable> | null>(null)
|
|
244
234
|
let listRequestId = 0
|
|
245
235
|
|
|
236
|
+
// ---------- 对话框状态 ----------
|
|
237
|
+
const editorDialogVisible = ref(false) // 新增/修改对话框是否显示。
|
|
238
|
+
const editorDialogMode = ref<'create' | 'edit'>('create') // 当前对话框形态。
|
|
239
|
+
const editorDialogPredRefNo = ref('') // 修改模式的预报流水号。
|
|
240
|
+
const detailDialogVisible = ref(false) // 详情对话框是否显示。
|
|
241
|
+
const detailDialogPredRefNo = ref('') // 详情模式的预报流水号。
|
|
242
|
+
|
|
246
243
|
const listHasReference = (row: ForecastRow) => Boolean(row.predRefNo?.trim())
|
|
247
244
|
const listTextColumn = (prop: keyof ForecastRow, label: string, width: number, visible = true): ColumnOption<ForecastRow> => ({
|
|
248
245
|
prop, label, width, visible, showOverflowTooltip: true,
|
|
@@ -342,25 +339,29 @@ const changeListPage = (current: number, size = listPagination.size) => {
|
|
|
342
339
|
void loadList()
|
|
343
340
|
}
|
|
344
341
|
|
|
345
|
-
//
|
|
342
|
+
// 行内操作交给对话框处理,整行记录用于补齐详情接口没有返回的字段。
|
|
346
343
|
const openEdit = (row: ForecastRow) => {
|
|
347
344
|
if (listBusy.value || !listHasReference(row)) return
|
|
348
345
|
const predRefNo = row.predRefNo?.trim()
|
|
349
346
|
if (!predRefNo) return
|
|
350
347
|
rememberForecastRow(row)
|
|
351
|
-
|
|
348
|
+
editorDialogPredRefNo.value = predRefNo
|
|
349
|
+
editorDialogMode.value = 'edit'
|
|
350
|
+
editorDialogVisible.value = true
|
|
352
351
|
}
|
|
353
352
|
const openDetail = (row: ForecastRow) => {
|
|
354
353
|
if (listBusy.value || !listHasReference(row)) return
|
|
355
|
-
const predRefNo = row.predRefNo?.trim()
|
|
354
|
+
const predRefNo = row.prefRefNo ?? row.predRefNo?.trim()
|
|
356
355
|
if (!predRefNo) return
|
|
357
356
|
rememberForecastRow(row)
|
|
358
|
-
|
|
357
|
+
detailDialogPredRefNo.value = predRefNo
|
|
358
|
+
detailDialogVisible.value = true
|
|
359
359
|
}
|
|
360
360
|
const openCreate = () => {
|
|
361
361
|
if (listBusy.value) return
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
editorDialogPredRefNo.value = ''
|
|
363
|
+
editorDialogMode.value = 'create'
|
|
364
|
+
editorDialogVisible.value = true
|
|
364
365
|
}
|
|
365
366
|
|
|
366
367
|
async function deleteRecords(records: ForecastRow[]) {
|
|
@@ -387,7 +388,7 @@ async function deleteRecords(records: ForecastRow[]) {
|
|
|
387
388
|
|
|
388
389
|
// 列表页由 KeepAlive 缓存;每次回到列表时重新查询,保留筛选条件和分页。
|
|
389
390
|
onActivated(() => {
|
|
390
|
-
|
|
391
|
+
void loadList()
|
|
391
392
|
})
|
|
392
393
|
|
|
393
394
|
// ---------- 新增 / 修改页 ----------
|
|
@@ -401,7 +402,8 @@ type EditorField = {
|
|
|
401
402
|
createOnly?: boolean
|
|
402
403
|
}
|
|
403
404
|
|
|
404
|
-
const editorMode = computed<'create' | 'edit'>(() =>
|
|
405
|
+
const editorMode = computed<'create' | 'edit'>(() => editorDialogMode.value)
|
|
406
|
+
const editorPredRefNo = computed(() => editorDialogPredRefNo.value?.trim() || '')
|
|
405
407
|
|
|
406
408
|
/** 修改时允许提交的字段;与新增接口保持同一组业务字段。 */
|
|
407
409
|
const editableFields = [
|
|
@@ -457,7 +459,6 @@ const loadError = ref('')
|
|
|
457
459
|
const initialValues = ref<Partial<ForecastFormValues>>({})
|
|
458
460
|
const requiredFields = new Set<FieldKey>(['clientName', 'payDirec', 'busiType', 'payChannel', 'groundBranch', 'tranDate', 'predDate', 'predAmt'])
|
|
459
461
|
const editorDisabled = computed(() => editorLoading.value || submitting.value)
|
|
460
|
-
const editorPredRefNo = computed(() => props.predRefNo?.trim() || '')
|
|
461
462
|
const editorTitle = computed(() => editorMode.value === 'create' ? '新增数字人民币头寸预报' : '修改数字人民币头寸预报')
|
|
462
463
|
const visibleGroups = computed(() => fieldGroups.map(group => ({
|
|
463
464
|
...group,
|
|
@@ -482,7 +483,7 @@ const fieldPlaceholder = (field: EditorField) => {
|
|
|
482
483
|
const initializeForm = () => {
|
|
483
484
|
const nextValues = createFormValues()
|
|
484
485
|
if (editorMode.value === 'create') {
|
|
485
|
-
nextValues.tranDate =
|
|
486
|
+
nextValues.tranDate = dcpsRuntime.date
|
|
486
487
|
nextValues.predDate = dcpsRuntime.date
|
|
487
488
|
} else {
|
|
488
489
|
for (const key of Object.keys(nextValues) as FieldKey[]) {
|
|
@@ -532,12 +533,7 @@ const loadEditorDetail = async () => {
|
|
|
532
533
|
}
|
|
533
534
|
}
|
|
534
535
|
|
|
535
|
-
//
|
|
536
|
-
onActivated(() => {
|
|
537
|
-
if (!isEditor.value) return
|
|
538
|
-
if (editorMode.value === 'create') initializeForm()
|
|
539
|
-
else void loadEditorDetail()
|
|
540
|
-
})
|
|
536
|
+
// 新增或修改每次打开对话框时重新初始化。
|
|
541
537
|
|
|
542
538
|
watch(form, () => { formError.value = '' }, { deep: true })
|
|
543
539
|
|
|
@@ -636,7 +632,7 @@ const detailGroups: { title: string; fields: DetailField[] }[] = [
|
|
|
636
632
|
const detail = ref<ForecastDetail | null>(null)
|
|
637
633
|
const detailLoading = ref(false)
|
|
638
634
|
const detailError = ref('')
|
|
639
|
-
const detailPredRefNo = computed(() =>
|
|
635
|
+
const detailPredRefNo = computed(() => detailDialogPredRefNo.value?.trim() || '')
|
|
640
636
|
const detailTitle = computed(() => detailPredRefNo.value ? `预报详情 · ${detailPredRefNo.value}` : '数字人民币头寸预报详情')
|
|
641
637
|
const detailRow = computed<ForecastRow>(() => ({ ...recallForecastRow(detailPredRefNo.value), predRefNo: detailPredRefNo.value }))
|
|
642
638
|
|