优化
This commit is contained in:
@@ -177,8 +177,8 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
|||||||
it.each([
|
it.each([
|
||||||
[[], ['查看'], false],
|
[[], ['查看'], false],
|
||||||
[['inbound-order:create'], ['查看', '生成入库计划'], false],
|
[['inbound-order:create'], ['查看', '生成入库计划'], false],
|
||||||
[['last-mile-order:edit'], ['查看', '暂扣订单', '人工修改节点'], false],
|
[['last-mile-order:edit'], ['查看', '人工修改节点'], false],
|
||||||
[['inbound-order:create', 'last-mile-order:edit'], ['查看', '生成入库计划', '暂扣订单', ''], true],
|
[['inbound-order:create', 'last-mile-order:edit'], ['查看', '生成入库计划', '人工修改节点'], false],
|
||||||
])('only collapses row actions above three for %j', async (allowed, labels, overflow) => {
|
])('only collapses row actions above three for %j', async (allowed, labels, overflow) => {
|
||||||
canAccess.mockImplementation(code => allowed.some(action => code === 'platform:overseas-warehouse:' + action))
|
canAccess.mockImplementation(code => allowed.some(action => code === 'platform:overseas-warehouse:' + action))
|
||||||
vi.mocked(listLastMileOrders).mockResolvedValue({ records: [{ id: 'order-1', customerId, orderNo: 'LM-1', currentStatus: 'PENDING_ASSIGNMENT', orderType: 'FIRST_LEG' }], page: 1, size: 10, total: 1, pages: 1 })
|
vi.mocked(listLastMileOrders).mockResolvedValue({ records: [{ id: 'order-1', customerId, orderNo: 'LM-1', currentStatus: 'PENDING_ASSIGNMENT', orderType: 'FIRST_LEG' }], page: 1, size: 10, total: 1, pages: 1 })
|
||||||
@@ -213,9 +213,9 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['PENDING_ASSIGNMENT', true],
|
['PENDING_ASSIGNMENT', false],
|
||||||
['INBOUND_COMPLETED', false],
|
['INBOUND_COMPLETED', true],
|
||||||
])('only enables a new hold after inbound completion for %s', async (currentStatus, disabled) => {
|
])('only shows a new hold after inbound completion for %s', async (currentStatus, visible) => {
|
||||||
canAccess.mockImplementation(code => code === 'platform:overseas-warehouse:last-mile-order:edit')
|
canAccess.mockImplementation(code => code === 'platform:overseas-warehouse:last-mile-order:edit')
|
||||||
vi.mocked(listLastMileOrders).mockResolvedValue({ records: [{
|
vi.mocked(listLastMileOrders).mockResolvedValue({ records: [{
|
||||||
id: 'order-1', customerId, orderNo: 'LM-1', currentStatus, orderType: 'FIRST_LEG', detained: false,
|
id: 'order-1', customerId, orderNo: 'LM-1', currentStatus, orderType: 'FIRST_LEG', detained: false,
|
||||||
@@ -223,8 +223,22 @@ describe('LastMileOrdersView pending order and container conversion', () => {
|
|||||||
|
|
||||||
const wrapper = await mountView()
|
const wrapper = await mountView()
|
||||||
const holdButton = wrapper.get('.el-table__body-wrapper .row-actions').findAll('button')
|
const holdButton = wrapper.get('.el-table__body-wrapper .row-actions').findAll('button')
|
||||||
.find(item => item.text().includes('暂扣订单'))!
|
.find(item => item.text().includes('暂扣订单'))
|
||||||
expect((holdButton.element as HTMLButtonElement).disabled).toBe(disabled)
|
expect(Boolean(holdButton)).toBe(visible)
|
||||||
|
if (holdButton) expect((holdButton.element as HTMLButtonElement).disabled).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('keeps release hold available for an already detained order', async () => {
|
||||||
|
canAccess.mockImplementation(code => code === 'platform:overseas-warehouse:last-mile-order:edit')
|
||||||
|
vi.mocked(listLastMileOrders).mockResolvedValue({ records: [{
|
||||||
|
id: 'order-held', customerId, orderNo: 'LM-HELD', currentStatus: 'READY_FOR_DISPATCH', orderType: 'FIRST_LEG', detained: true,
|
||||||
|
}], page: 1, size: 10, total: 1, pages: 1 })
|
||||||
|
|
||||||
|
const wrapper = await mountView()
|
||||||
|
const releaseButton = wrapper.get('.el-table__body-wrapper .row-actions').findAll('button')
|
||||||
|
.find(item => item.text().includes('解除暂扣'))
|
||||||
|
expect(releaseButton).toBeTruthy()
|
||||||
|
expect((releaseButton!.element as HTMLButtonElement).disabled).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('removes generation and hold actions after an inbound plan has been submitted', async () => {
|
it('removes generation and hold actions after an inbound plan has been submitted', async () => {
|
||||||
|
|||||||
@@ -833,7 +833,7 @@ function lastMileRowActions(row: LastMileOrderListItem): RowActionItem[] {
|
|||||||
{ key: 'review-return', label: '审核', priority: 460, tone: 'warning', visible: access.can(permission.returnOrderReview) && row.orderTypeCode === 'RETURN_RELABEL' && row.currentStatusCode === 'PENDING_REVIEW' },
|
{ key: 'review-return', label: '审核', priority: 460, tone: 'warning', visible: access.can(permission.returnOrderReview) && row.orderTypeCode === 'RETURN_RELABEL' && row.currentStatusCode === 'PENDING_REVIEW' },
|
||||||
{ key: 'review', label: '审核', priority: 450, tone: 'warning', visible: access.can(permission.warehouseTransferApprove) && row.orderTypeCode === 'WAREHOUSE_TRANSFER' && row.currentStatusCode === 'PENDING_REVIEW' },
|
{ key: 'review', label: '审核', priority: 450, tone: 'warning', visible: access.can(permission.warehouseTransferApprove) && row.orderTypeCode === 'WAREHOUSE_TRANSFER' && row.currentStatusCode === 'PENDING_REVIEW' },
|
||||||
{ key: 'inbound-plan', label: '生成入库计划', priority: 400, visible: access.can(permission.inboundOrderCreate) && !inboundPlanCreated },
|
{ key: 'inbound-plan', label: '生成入库计划', priority: 400, visible: access.can(permission.inboundOrderCreate) && !inboundPlanCreated },
|
||||||
{ key: 'hold', label: row.detained ? '解除暂扣' : '暂扣订单', priority: 300, tone: 'warning', visible: access.can(permission.lastMileOrderTransfer) && (row.detained || !inboundPlanCreated || row.currentStatusCode === 'INBOUND_COMPLETED'), disabled: !row.detained && row.currentStatusCode !== 'INBOUND_COMPLETED' },
|
{ key: 'hold', label: row.detained ? '解除暂扣' : '暂扣订单', priority: 300, tone: 'warning', visible: access.can(permission.lastMileOrderTransfer) && (row.detained || row.currentStatusCode === 'INBOUND_COMPLETED') },
|
||||||
{ key: 'manual-nodes', label: '人工修改节点', priority: 200, visible: access.can(permission.lastMileOrderTransfer) },
|
{ key: 'manual-nodes', label: '人工修改节点', priority: 200, visible: access.can(permission.lastMileOrderTransfer) },
|
||||||
{ key: 'confirm-relabel', label: '换标完成确认', priority: 150, visible: access.can(permission.relabelOrderStatus) && Boolean(row.relabelOrderNo) && canConfirmRelabel(row) },
|
{ key: 'confirm-relabel', label: '换标完成确认', priority: 150, visible: access.can(permission.relabelOrderStatus) && Boolean(row.relabelOrderNo) && canConfirmRelabel(row) },
|
||||||
{ key: 'rework-relabel', label: '重新换标', priority: 100, tone: 'danger', divided: true, visible: access.can(permission.relabelOrderStatus) && Boolean(row.relabelOrderNo) && canReworkRelabel(row) },
|
{ key: 'rework-relabel', label: '重新换标', priority: 100, tone: 'danger', divided: true, visible: access.can(permission.relabelOrderStatus) && Boolean(row.relabelOrderNo) && canReworkRelabel(row) },
|
||||||
|
|||||||
Reference in New Issue
Block a user