修复企业管理员角色无法红冲的问题;修复操作列按钮高低不齐的问题

This commit is contained in:
BBIT-Kai
2026-05-27 09:29:06 +08:00
parent 9fd80980e7
commit a716c481da
10 changed files with 118 additions and 22 deletions
+2
View File
@@ -458,6 +458,8 @@ export function invoiceIssueApi(payload: InvoiceRequest): Promise<string> {
export interface RedCreateRequest {
/** 蓝票历史记录 ID */
historyId: string
/** 平台数电账号 ID。企业管理员冲红时用于指定开票员 */
digitalAccountId?: string | null
/** 冲红原因:01开票有误 02销货退回 03服务中止 04销售折让 */
redReason: string
/** 收票人名称 */
@@ -431,6 +431,16 @@
label-placement="top"
require-mark-placement="right-hanging"
>
<n-form-item label="开票员" path="digitalAccountId">
<n-select
v-model:value="redForm.digitalAccountId"
:options="digitalAccountOptions"
:loading="digitalAccountLoading"
placeholder="请选择开票员"
filterable
clearable
/>
</n-form-item>
<n-form-item label="冲红原因" path="redReason">
<n-select
v-model:value="redForm.redReason"
@@ -496,6 +506,7 @@ import {
invoiceHistoryApi,
invoiceKindMap,
invoiceStatusMap,
listDigitalAccountsApi,
queryInvoiceApi,
redInvoiceCreateApi,
redInvoiceDownloadUrlApi,
@@ -507,6 +518,7 @@ import type {
InvoiceDetailGoods,
InvoiceDetailResponse,
InvoiceDetailVoucher,
DigitalAccountItem,
InvoiceHistoryItem,
RedCreateRequest,
RedInvoiceInfo
@@ -973,9 +985,12 @@ async function refreshStatus(item: InvoiceHistoryItem) {
const showRedForm = ref(false)
const redSubmitting = ref(false)
const redFormRef = ref()
const digitalAccountLoading = ref(false)
const digitalAccounts = ref<DigitalAccountItem[]>([])
const redForm = reactive({
historyId: '',
digitalAccountId: null as string | null,
redReason: '01',
takerName: '',
takerTel: '',
@@ -989,17 +1004,40 @@ const redReasonOptions = [
{ label: '销售折让', value: '04' }
]
const digitalAccountOptions = computed(() =>
digitalAccounts.value.map((item) => ({
label: `${item.account}${item.name ? `${item.name}` : ''}`,
value: item.id
}))
)
const redFormRules = {
digitalAccountId: [{ required: true, message: '请选择开票员', trigger: 'change' }],
redReason: [{ required: true, message: '请选择冲红原因', trigger: 'change' }]
}
function startRedTask(item: InvoiceHistoryItem) {
async function ensureDigitalAccountsLoaded() {
if (digitalAccounts.value.length > 0) return
digitalAccountLoading.value = true
try {
digitalAccounts.value = await listDigitalAccountsApi()
} finally {
digitalAccountLoading.value = false
}
}
async function startRedTask(item: InvoiceHistoryItem) {
redForm.historyId = item.id
redForm.digitalAccountId = null
redForm.redReason = '01'
redForm.takerName = ''
redForm.takerTel = ''
redForm.takerEmail = ''
showRedForm.value = true
await ensureDigitalAccountsLoaded()
if (!redForm.digitalAccountId && digitalAccounts.value.length === 1) {
redForm.digitalAccountId = digitalAccounts.value[0].id
}
}
async function handleRedSubmit() {
@@ -1012,6 +1050,7 @@ async function handleRedSubmit() {
try {
const payload: RedCreateRequest = {
historyId: redForm.historyId,
digitalAccountId: redForm.digitalAccountId,
redReason: redForm.redReason,
takerName: redForm.takerName || undefined,
takerTel: redForm.takerTel || undefined,
@@ -45,7 +45,7 @@
</div>
</section>
<n-drawer v-model:show="drawerVisible" :width="760">
<n-drawer v-model:show="drawerVisible" :width="980">
<n-drawer-content :title="drawerTitle" closable>
<div class="drawer-toolbar">
<n-select
@@ -87,7 +87,7 @@
:data="tasks"
:loading="taskLoading"
:pagination="taskPagination"
:scroll-x="980"
:scroll-x="1280"
remote
@update:page="loadTasks"
@update:page-size="changeTaskPageSize"
@@ -276,10 +276,10 @@ const taskColumns: DataTableColumns<OpenInvoiceTaskItem> = [
h(NTag, { type: statusTagType(row.status), size: 'small' }, { default: () => row.status })
},
{ title: 'PT码', key: 'ptCode', width: 90 },
{ title: '错误', key: 'errorMessage', minWidth: 260, ellipsis: { tooltip: true } },
{ title: '查询次数', key: 'pollCount', width: 90, render: (row) => `${row.pollCount}/${row.maxPollCount}` },
{ title: '重试', key: 'attemptCount', width: 90, render: (row) => `${row.attemptCount}/${row.maxAttemptCount}` },
{ title: '下次执行', key: 'nextRunAt', minWidth: 150 },
{ title: '错误', key: 'errorMessage', minWidth: 180 }
{ title: '下次执行', key: 'nextRunAt', minWidth: 150 }
]
const taskPagination = reactive<PaginationProps>({
+1 -1
View File
@@ -262,7 +262,7 @@ function renderLabel(payload: { option: unknown }) {
? h(NTag, { size: 'small', type: 'primary' }, { default: () => '基础内置' })
: null
]),
h(NSpace, { size: 6, class: 'menu-tree-actions' }, () => [
h(NSpace, { size: 6, align: 'center', class: 'menu-tree-actions table-action-buttons' }, () => [
h(
NButton,
{ size: 'small', tertiary: true, class: 'action-btn', onClick: () => openCreate(node.id) },
+1 -1
View File
@@ -256,7 +256,7 @@ const columns = computed<DataTableColumns<RoleItem>>(() => [
title: '操作',
key: 'actions',
render: (r) =>
h(NSpace, { size: 6 }, () => [
h(NSpace, { size: 6, align: 'center', class: 'table-action-buttons' }, () => [
h(
NButton,
{
+1 -1
View File
@@ -660,7 +660,7 @@ const columns = computed<DataTableColumns<UserListItem>>(() => [
render: (row) =>
h(
NSpace,
{ size: 6 },
{ size: 6, align: 'center', class: 'table-action-buttons' },
{
default: () => [
h(
+34
View File
@@ -213,6 +213,40 @@ select {
min-width: 68px;
}
.table-action-buttons,
.row-actions,
.table-actions,
.action-buttons {
display: flex;
align-items: center;
gap: 6px;
line-height: 1;
white-space: nowrap;
}
.table-action-buttons {
flex-wrap: nowrap;
}
.table-action-buttons .n-button,
.row-actions .n-button,
.table-actions .n-button,
.action-buttons .n-button {
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
vertical-align: middle;
}
.table-action-buttons .n-button__content,
.row-actions .n-button__content,
.table-actions .n-button__content,
.action-buttons .n-button__content {
display: inline-flex;
align-items: center;
}
.soft-stat {
border: 1px solid var(--app-border);
border-radius: 12px;