修复发件箱部分投递状态显示
Some checks are pending
Security Checks / security (push) Waiting to run

This commit is contained in:
smail 2026-09-30 23:25:57 +08:00
parent 503cba5431
commit e4486885e4
3 changed files with 26 additions and 0 deletions

View File

@ -298,6 +298,11 @@ export function usePage() {
errorDialogVisible.value = true
}
const isPartialDelivery = function (row) {
if (row?.status !== 2) return false
return /^投递未全部完成;已接收\s*[1-9]\d*,失败\s*[1-9]\d*/.test(String(row.error || ''))
}
return {
EpArrowDownBold,
Delete,
@ -341,6 +346,7 @@ export function usePage() {
isOutbox,
trustSender,
showError,
isPartialDelivery,
errorDialogVisible,
currentErrorMsg,
isRefreshing,

View File

@ -92,6 +92,11 @@
<el-icon><Warning /></el-icon> 投递结果待核对
</el-tag>
</el-tooltip>
<el-tooltip :content="scope.row.error" placement="top" v-else-if="isPartialDelivery(scope.row)">
<el-tag type="warning" effect="light" size="small" class="clickable-tag" @click.stop="showError(scope.row)">
<el-icon><Warning /></el-icon> 部分成功 (查看详情)
</el-tag>
</el-tooltip>
<el-tag type="success" effect="light" size="small" v-else-if="scope.row.status === 1 && !scope.row.error">
<el-icon><Check /></el-icon> 发送成功
</el-tag>
@ -164,6 +169,7 @@ const {
isOutbox,
trustSender,
showError,
isPartialDelivery,
errorDialogVisible,
currentErrorMsg,
isRefreshing,

View File

@ -11,6 +11,20 @@ const Vue = require('vue')
const { parse, compileScript } = require('@vue/compiler-sfc')
const read = name => readFileSync(new URL(`../../frontend/${name}`, import.meta.url), 'utf8')
test('发件箱必须区分部分成功与全部失败', () => {
const source = read('src/views/List/List.js')
.replace(/^import .*$/gm, '')
.replace('export function usePage', 'function usePage')
.replace(/export \{[^}]+\}\s*$/, '')
const { isPartialDelivery } = compileFunction(source + '\nreturn { isPartialDelivery }')()
assert.equal(isPartialDelivery({
status: 2,
error: '投递未全部完成;已接收 1,失败 1。已接收的收件人不会自动重投'
}), true)
assert.equal(isPartialDelivery({ status: 2, error: '投递失败;已接收 0,失败 2' }), false)
assert.equal(isPartialDelivery({ status: 1, error: '' }), false)
})
test('邮件列表挂载后,表格选中项必须用于全选和批量操作', async () => {
const source = read('src/views/List/List.js').replace(/^import .*$/gm, '')
.replace('export function usePage', 'function usePage').replace(/export \{[^}]+\}\s*$/, '')