Commit 3515f7dd by chenwq

优化获取可见金额字段的逻辑,支持排除已审批的费用类别

1 parent 4d3190be
...@@ -119,8 +119,8 @@ export function normalizeApprovedMarketTransferFees(list = []) { ...@@ -119,8 +119,8 @@ export function normalizeApprovedMarketTransferFees(list = []) {
}; };
} }
export function getVisibleAmountFields(expenseCategoryIds = []) { export function getVisibleAmountFields(expenseCategoryIds = [], excludeExpenseCategoryIds = []) {
return EXPENSE_CATEGORY_OPTIONS.filter(item => expenseCategoryIds.includes(item.id)); return EXPENSE_CATEGORY_OPTIONS.filter(item => expenseCategoryIds.includes(item.id) && !excludeExpenseCategoryIds.includes(item.id));
} }
export function mapMarketFeeResults(data = {}) { export function mapMarketFeeResults(data = {}) {
......
...@@ -200,7 +200,7 @@ export default { ...@@ -200,7 +200,7 @@ export default {
return this.transferForm.billType == "1" ? "所属流量方" : "所属服务商"; return this.transferForm.billType == "1" ? "所属流量方" : "所属服务商";
}, },
visibleAmountFields() { visibleAmountFields() {
return getVisibleAmountFields(this.transferForm.expenseCategoryIds); return getVisibleAmountFields(this.transferForm.expenseCategoryIds, this.lockedExpenseCategoryIds);
}, },
platformFormData() { platformFormData() {
return [ return [
......
...@@ -17,6 +17,12 @@ describe("marketTransfer helpers", () => { ...@@ -17,6 +17,12 @@ describe("marketTransfer helpers", () => {
expect(fields.map(item => item.id)).toEqual([706, 900]) expect(fields.map(item => item.id)).toEqual([706, 900])
}) })
it("hides amount fields for expense categories already in approval", () => {
const fields = getVisibleAmountFields([706, 808, 900], [706, 900])
expect(fields.map(item => item.id)).toEqual([808])
})
it("maps market fee result rows by expense category id", () => { it("maps market fee result rows by expense category id", () => {
const result = mapMarketFeeResults({ const result = mapMarketFeeResults({
list: [ list: [
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!