vue3-element-plus-app-chu 0.0.32 → 0.0.33

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": "vue3-element-plus-app-chu",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -80,13 +80,9 @@ const formatAmount = (value?: string): string => {
80
80
  return `${negative ? '-' : ''}${grouped}.${fraction.padEnd(2, '0')}`
81
81
  }
82
82
 
83
- /**
84
- * 按各项系数精确计算金额合计;任一金额无法解析时返回空字符串。
85
- * emptyAsZero 为 true 时空文本按 0 参与计算(用于输入框的实时轧差)。
86
- */
87
- const calcTotalAmount = (terms: Array<[string, 1 | -1]>, emptyAsZero = false): string => {
83
+ /** 按各项系数精确计算金额合计;任一金额为空或无法解析时返回空字符串。 */
84
+ const calcTotalAmount = (terms: Array<[string, 1 | -1]>): string => {
88
85
  const parse = (value: string) => {
89
- if (!value?.trim() && emptyAsZero) value = '0'
90
86
  const normalized = normalizeAmount(value)
91
87
  if (!normalized) return null
92
88
  const negative = normalized.startsWith('-')
@@ -113,8 +109,8 @@ const calcTotalAmount = (terms: Array<[string, 1 | -1]>, emptyAsZero = false): s
113
109
  }
114
110
 
115
111
  /** 计算轧差(收入减支出),与报表合计共用精确金额运算。 */
116
- const calcGapAmount = (inAmt: string, outAmt: string, emptyAsZero = false): string =>
117
- calcTotalAmount([[inAmt, 1], [outAmt, -1]], emptyAsZero)
112
+ const calcGapAmount = (inAmt: string, outAmt: string): string =>
113
+ calcTotalAmount([[inAmt, 1], [outAmt, -1]])
118
114
 
119
115
  /** 收支方向字典:I 来账、O 往账。 */
120
116
  const payDirecLabels: Record<string, string> = { I: '来账', O: '往账' }
@@ -195,19 +191,20 @@ const gapText = (inPosition: string, outPosition: string): string => {
195
191
  return calcGapAmount(amountOf(inPosition), amountOf(outPosition))
196
192
  }
197
193
 
198
- /** 今日预计调拨金额行的实时轧差:随输入即时计算,空输入按 0 参与计算。 */
194
+ /** 今日预计调拨金额行的实时轧差:随输入即时计算,任一输入为空时留空。 */
199
195
  const inputGapText = computed(() =>
200
- calcGapAmount(queryForm.predictAllotInAmt, queryForm.predictAllotOutAmt, true))
196
+ calcGapAmount(queryForm.predictAllotInAmt, queryForm.predictAllotOutAmt))
201
197
 
202
198
  /** 数币账户预留金额 C12 = C3 + C6 - D6 + C8 - D8 + (C11 - D11),随调拨输入实时更新。 */
203
199
  const reservedBalanceText = computed(() =>
204
200
  calcTotalAmount([[openingBalanceText.value, 1], [inputGapText.value, 1]]))
205
201
 
206
- /** 校验金额文本:须为不小于 0、最多两位小数的十进制金额;返回错误提示文本。 */
202
+ /** 提交时校验金额:不能为空,允许负数,最多保留两位小数。 */
207
203
  const checkAmount = (value: string): string => {
204
+ if (!value.trim()) return '请输入预计调拨金额'
208
205
  const normalized = normalizeAmount(value)
209
- if (!normalized || normalized.startsWith('-') || (normalized.split('.')[1]?.length || 0) > 2) {
210
- return '须为不小于 0 的金额,最多保留两位小数'
206
+ if (!normalized || (normalized.split('.')[1]?.length || 0) > 2) {
207
+ return '请输入有效金额,允许负数,最多保留两位小数'
211
208
  }
212
209
  return ''
213
210
  }
@@ -299,6 +296,9 @@ const submitExport = () => {
299
296
  // 弹窗状态:cell 为被单击的报表单元格;明细请求在弹窗打开时发起。
300
297
  const detailVisible = ref(false)
301
298
  const detailCell = ref<EstimationCell | null>(null)
299
+ // 报备金额、未核销金额仅展示预报;未核销业务流水仅展示流水。
300
+ const showPredDetail = computed(() => ['C6', 'C7', 'D6', 'D7'].includes(detailCell.value?.position || ''))
301
+ const showTranDetail = computed(() => ['C8', 'D8'].includes(detailCell.value?.position || ''))
302
302
  const detailPredList = ref<EstimationPredRow[]>([])
303
303
  const detailTranList = ref<EstimationTranRow[]>([])
304
304
  const detailTotalCount = ref('')
@@ -349,10 +349,12 @@ const openDetail = (cell?: EstimationCell) => {
349
349
  detailVisible.value = true
350
350
  }
351
351
 
352
- /** 合并预报、流水列表得到明细总条数;接口 totalCount 缺失时按列表长度兜底展示。 */
352
+ /** 明细总条数优先使用接口 totalCount,缺失时仅统计当前展示的列表。 */
353
353
  const resolveTotal = () => {
354
354
  if (/^\d+$/.test(detailTotalCount.value)) return detailTotalCount.value
355
- return String(detailPredList.value.length + detailTranList.value.length)
355
+ if (showPredDetail.value) return String(detailPredList.value.length)
356
+ if (showTranDetail.value) return String(detailTranList.value.length)
357
+ return '0'
356
358
  }
357
359
 
358
360
  // 页面首次显示时按默认日期预填预计调拨收支金额。
@@ -490,7 +492,6 @@ onBeforeUnmount(() => {
490
492
  <el-input
491
493
  v-model="queryForm.predictAllotInAmt"
492
494
  class="report-input"
493
- inputmode="decimal"
494
495
  placeholder="输入调拨收入金额"
495
496
  :maxlength="40"
496
497
  @input="formError.predictAllotInAmt = ''"
@@ -501,7 +502,6 @@ onBeforeUnmount(() => {
501
502
  <el-input
502
503
  v-model="queryForm.predictAllotOutAmt"
503
504
  class="report-input"
504
- inputmode="decimal"
505
505
  placeholder="输入调拨支出金额"
506
506
  :maxlength="40"
507
507
  @input="formError.predictAllotOutAmt = ''"
@@ -543,7 +543,7 @@ onBeforeUnmount(() => {
543
543
  </div>
544
544
  </el-card>
545
545
 
546
- <!-- 单元格明细弹窗:按位置编码查询预报与流水列表。 -->
546
+ <!-- 单元格明细弹窗:按位置编码查询,并仅展示对应的预报或流水列表。 -->
547
547
  <el-dialog
548
548
  v-model="detailVisible"
549
549
  :title="detailCell ? `匡算明细 - ${detailCell.label}` : '匡算明细'"
@@ -577,9 +577,9 @@ onBeforeUnmount(() => {
577
577
  </header>
578
578
 
579
579
  <div v-loading="detailLoading" class="detail-tables">
580
- <!-- 预报信息明细;列表为空时展示统一空态。 -->
581
- <div class="dialog-section-title">预报信息</div>
582
- <el-table :data="detailPredList" :size="tableSize" border max-height="240px" empty-text="暂无预报信息">
580
+ <!-- C6/C7/D6/D7 仅展示预报信息;列表为空时展示统一空态。 -->
581
+ <div v-if="showPredDetail" class="dialog-section-title">预报信息</div>
582
+ <el-table v-if="showPredDetail" :data="detailPredList" :size="tableSize" border max-height="240px" empty-text="暂无预报信息">
583
583
  <el-table-column label="预报流水号" min-width="150" show-overflow-tooltip>
584
584
  <template #default="{ row }">{{ displayText(row.predRefNo) }}</template>
585
585
  </el-table-column>
@@ -615,9 +615,9 @@ onBeforeUnmount(() => {
615
615
  </el-table-column>
616
616
  </el-table>
617
617
 
618
- <!-- 流水信息明细;失败的详情可重新打开弹窗重试。 -->
619
- <div class="dialog-section-title">流水信息</div>
620
- <el-table :data="detailTranList" :size="tableSize" border max-height="240px" empty-text="暂无流水信息">
618
+ <!-- C8/D8 仅展示流水信息;失败的详情可重新打开弹窗重试。 -->
619
+ <div v-if="showTranDetail" class="dialog-section-title">流水信息</div>
620
+ <el-table v-if="showTranDetail" :data="detailTranList" :size="tableSize" border max-height="240px" empty-text="暂无流水信息">
621
621
  <el-table-column label="交易参考号" min-width="150" show-overflow-tooltip>
622
622
  <template #default="{ row }">{{ displayText(row.refNo) }}</template>
623
623
  </el-table-column>