优化样式
This commit is contained in:
@@ -2,6 +2,7 @@ import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { transpileModule, ScriptTarget } from 'typescript'
|
||||
import { computed, ref, reactive, watch } from 'vue'
|
||||
|
||||
const view = readFileSync(new URL('./WarehouseServiceView.vue', import.meta.url), 'utf8')
|
||||
|
||||
@@ -18,6 +19,8 @@ test('退货箱明细与来源下拉使用同一份逐箱库存,不请求普
|
||||
cartonSkuItems: [{ skuCode: 'A', quantity: 1 }] },
|
||||
{ sourceType: 'RETURN_CARTON', inboundOrderNo: 'OTHER', cartonMark: 'FOREIGN', cartonAvailablePackages: 1 },
|
||||
{ sourceType: 'RETURN_CARTON', inboundOrderNo: 'RET-1', cartonMark: 'OCCUPIED', cartonAvailablePackages: 0 },
|
||||
{ sourceType: 'RETURN_CARTON', inboundOrderNo: 'RET-1', cartonMark: 'LABELLED', cartonAvailablePackages: 1, relabelStatus: 'COMPLETED' },
|
||||
{ sourceType: 'RETURN_CARTON', inboundOrderNo: 'RET-1', cartonMark: 'PARTIAL', cartonAvailablePackages: 1, relabelledQuantity: 2 },
|
||||
] }, getTransferSourceCartons: () => { throw Error('不应调用普通来源箱查询') } }
|
||||
const load = new Function(...Object.keys(ctx), 'let transferSourceRequest=0;' + code + ';return loadTransferSourceCartons')(...Object.values(ctx))
|
||||
await load()
|
||||
@@ -28,6 +31,27 @@ test('退货箱明细与来源下拉使用同一份逐箱库存,不请求普
|
||||
assert.equal(ctx.transferSourceLoading.value, false)
|
||||
})
|
||||
|
||||
test('来源库存发往FBA默认开启贴标,清除来源或切换私人仓后恢复选项', () => {
|
||||
const source = ref(''), destination = ref('NONE'), form = reactive({ relabel: false })
|
||||
const inventoryTransfer = computed(() => Boolean(source.value))
|
||||
const body = view.slice(view.indexOf('const transferRelabelRequired ='), view.indexOf('const transferSourceCartons ='))
|
||||
const required = new Function('computed', 'watch', 'inventoryTransfer', 'transferDestinationType', 'form', body + ';return transferRelabelRequired')(
|
||||
computed, watch, inventoryTransfer, destination, form)
|
||||
destination.value = 'FBA'
|
||||
assert.equal(form.relabel, false)
|
||||
source.value = 'IN-1'
|
||||
assert.equal(required.value, true)
|
||||
assert.equal(form.relabel, true)
|
||||
destination.value = 'PRIVATE'
|
||||
assert.equal(required.value, false)
|
||||
form.relabel = false
|
||||
destination.value = 'FBA'
|
||||
assert.equal(form.relabel, true)
|
||||
source.value = ''
|
||||
assert.equal(required.value, false)
|
||||
assert.match(view, /<el-radio-button v-if="!transferRelabelRequired" :value="false">不需要贴标/)
|
||||
})
|
||||
|
||||
function setup() {
|
||||
const body = view.slice(view.indexOf('async function selectTransferInventory('), view.indexOf('function selectTransferInboundMethod('))
|
||||
const code = transpileModule(body, { compilerOptions: { target: ScriptTarget.ES2022 } }).outputText
|
||||
|
||||
Reference in New Issue
Block a user