Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bfe1277c
authored
Aug 12, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 门店工作汇报仅保留门店日报
1 parent
eab67aa8
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
773 additions
and
141 deletions
src/api/adapters/journalRecord/buildOverviewParams.js
src/api/adapters/journalRecord/mapDetailResponse.js
src/api/adapters/journalRecord/mapMerchantBrandContext.js
src/api/adapters/journalRecord/mapOverviewRow.js
src/api/journalRecord.js
src/views/residentManage/journalRecord/constants.js
src/views/residentManage/journalRecord/detail.vue
src/views/residentManage/journalRecord/index.vue
src/views/residentManage/journalRecord/utils/journalAccess.js
src/views/residentManage/journalRecord/utils/journalFormEcho.js
src/views/residentManage/journalRecord/utils/journalFormVisibility/groupShowRuleEval.js
src/views/residentManage/journalRecord/utils/journalFormVisibility/groupVisibility.js
src/views/residentManage/journalRecord/utils/journalFormVisibility/index.js
tests/unit/api/adapters/journalRecord/mapDetailResponse.spec.js
tests/unit/api/adapters/journalRecord/mapMerchantBrandContext.spec.js
tests/unit/api/adapters/journalRecord/mapOverviewRow.spec.js
tests/unit/views/residentManage/journalRecord/constants.spec.js
tests/unit/views/residentManage/journalRecord/detail.spec.js
tests/unit/views/residentManage/journalRecord/groupShowRuleEval.spec.js
tests/unit/views/residentManage/journalRecord/journalAccess.spec.js
tests/unit/views/residentManage/journalRecord/journalFormEcho.spec.js
tests/unit/views/residentManage/journalRecord/journalFormVisibility.spec.js
src/api/adapters/journalRecord/buildOverviewParams.js
View file @
bfe1277
...
...
@@ -3,7 +3,7 @@ import { getTemplateTypeByTabKey } from "@/views/residentManage/journalRecord/co
/**
* d2-table 查询参数 → dailyReport.overview.page 请求体
*/
export
function
buildOverviewParams
(
params
=
{},
activeTabKey
=
"st
aff
Daily"
)
{
export
function
buildOverviewParams
(
params
=
{},
activeTabKey
=
"st
ore
Daily"
)
{
const
payload
=
{
templateType
:
getTemplateTypeByTabKey
(
activeTabKey
),
reportDate
:
params
.
reportDate
,
...
...
src/api/adapters/journalRecord/mapDetailResponse.js
View file @
bfe1277
import
{
mapSceneType
}
from
"./mapSceneType"
;
function
normalizeContextList
(
value
)
{
if
(
Array
.
isArray
(
value
))
{
return
value
;
}
if
(
value
==
null
||
value
===
""
)
{
return
[];
}
return
String
(
value
).
split
(
","
).
filter
(
Boolean
);
}
/**
* 详情路由 query → dailyReport.detail.select 请求体
*/
...
...
@@ -18,6 +28,7 @@ export function mapDetailResponse(res = {}, fallback = {}) {
id
:
res
.
id
??
res
.
dailyReportRecordId
??
fallback
.
id
,
staffName
:
res
.
staffName
??
fallback
.
staffName
,
merchantName
:
res
.
merchantName
??
fallback
.
merchantName
,
templateType
:
res
.
templateType
??
fallback
.
templateType
,
bizType
:
res
.
bizType
??
scene
.
bizType
??
fallback
.
bizType
,
bizTypeName
:
res
.
bizTypeName
||
scene
.
bizTypeName
||
fallback
.
bizTypeName
,
reportDate
:
res
.
reportDate
??
fallback
.
reportDate
,
...
...
@@ -25,10 +36,10 @@ export function mapDetailResponse(res = {}, fallback = {}) {
fieldDataList
:
res
.
fieldDataList
,
subformDataList
:
res
.
subformDataList
,
reportTemplateId
:
res
.
reportTemplateId
,
baseSceneCode
:
res
.
baseSceneCode
,
baseSceneCode
:
res
.
baseSceneCode
??
fallback
.
baseSceneCode
,
sceneType
:
res
.
sceneType
??
fallback
.
sceneType
,
schema
:
res
.
schema
,
brandIds
:
res
.
brandIds
??
fallback
.
brandIds
??
[]
,
brandIds
:
normalizeContextList
(
res
.
brandIds
??
fallback
.
brandIds
)
,
sceneList
:
res
.
sceneList
??
fallback
.
sceneList
??
[],
};
}
...
...
src/api/adapters/journalRecord/mapMerchantBrandContext.js
0 → 100644
View file @
bfe1277
export
function
mapMerchantBrandContext
(
res
=
{},
merchantId
)
{
const
list
=
Array
.
isArray
(
res
.
list
)
?
res
.
list
:
[];
const
merchant
=
list
.
find
(
item
=>
String
(
item
.
merchantId
)
===
String
(
merchantId
));
if
(
!
merchant
||
!
Array
.
isArray
(
merchant
.
merchantBrandList
))
{
return
[];
}
return
merchant
.
merchantBrandList
.
map
(
item
=>
item
.
childId
??
item
.
brandId
)
.
filter
(
id
=>
id
!=
null
&&
id
!==
""
);
}
export
default
mapMerchantBrandContext
;
src/api/adapters/journalRecord/mapOverviewRow.js
View file @
bfe1277
...
...
@@ -22,6 +22,9 @@ export function mapOverviewRow(row = {}) {
submitTime
:
reportStatus
===
1
?
(
row
.
submitTime
??
createdDate
)
:
(
row
.
submitTime
||
""
),
reportDate
:
row
.
reportDate
,
templateType
:
row
.
templateType
,
baseSceneCode
:
row
.
baseSceneCode
,
brandIds
:
row
.
brandIds
,
sceneList
:
row
.
sceneList
,
reportStatus
,
};
}
...
...
src/api/journalRecord.js
View file @
bfe1277
import
request
from
"./request"
;
import
RequestMethods
from
"./request.methods"
;
import
{
buildOverviewParams
}
from
"./adapters/journalRecord/buildOverviewParams"
;
import
{
mapOverviewPageResponse
}
from
"./adapters/journalRecord/mapOverviewRow"
;
import
{
buildDetailSelectParams
,
mapDetailResponse
,
}
from
"./adapters/journalRecord/mapDetailResponse"
;
import
{
mapMerchantBrandContext
}
from
"./adapters/journalRecord/mapMerchantBrandContext"
;
import
{
mapMerchantListResponse
}
from
"./adapters/journalRecord/mapMerchantList"
;
import
{
mapMerchantStaffListResponse
}
from
"./adapters/journalRecord/mapMerchantStaffList"
;
import
{
mapOverviewPageResponse
}
from
"./adapters/journalRecord/mapOverviewRow"
;
import
request
from
"./request"
;
import
RequestMethods
from
"./request.methods"
;
const
path
=
"dj.api.smartcarlife."
;
// Vue CLI 在浏览器构建时注入 process.env。
// eslint-disable-next-line node/prefer-global/process
const
USE_MOCK
=
process
.
env
.
VUE_APP_JOURNAL_MOCK
===
"true"
;
function
loadMock
()
{
...
...
@@ -23,7 +26,7 @@ export function getDailyReportMerchantList(data = {}) {
...
data
,
};
if
(
USE_MOCK
)
{
return
loadMock
().
then
(
(
m
)
=>
m
.
mockDailyReportMerchantList
(
payload
));
return
loadMock
().
then
(
m
=>
m
.
mockDailyReportMerchantList
(
payload
));
}
payload
.
method
=
`
${
path
}
dailyReport.merchant.list`
;
return
request
(
payload
,
RequestMethods
.
POST
).
then
(
mapMerchantListResponse
);
...
...
@@ -37,8 +40,8 @@ export function getDailyReportMerchantListPage(data = {}) {
};
if
(
USE_MOCK
)
{
return
loadMock
()
.
then
(
(
m
)
=>
m
.
mockDailyReportMerchantList
(
payload
))
.
then
(
(
list
)
=>
({
.
then
(
m
=>
m
.
mockDailyReportMerchantList
(
payload
))
.
then
(
list
=>
({
list
,
total
:
list
.
length
,
pages
:
1
,
...
...
@@ -46,7 +49,7 @@ export function getDailyReportMerchantListPage(data = {}) {
}));
}
payload
.
method
=
`
${
path
}
dailyReport.merchant.list`
;
return
request
(
payload
,
RequestMethods
.
POST
).
then
(
(
res
)
=>
({
return
request
(
payload
,
RequestMethods
.
POST
).
then
(
res
=>
({
list
:
mapMerchantListResponse
(
res
),
total
:
res
.
total
??
0
,
pages
:
res
.
pages
??
1
,
...
...
@@ -56,7 +59,7 @@ export function getDailyReportMerchantListPage(data = {}) {
export
function
getDailyReportMerchantStaffList
(
data
=
{})
{
if
(
USE_MOCK
)
{
return
loadMock
().
then
(
(
m
)
=>
m
.
mockDailyReportMerchantStaffList
(
data
));
return
loadMock
().
then
(
m
=>
m
.
mockDailyReportMerchantStaffList
(
data
));
}
const
payload
=
{
...
data
,
...
...
@@ -65,9 +68,26 @@ export function getDailyReportMerchantStaffList(data = {}) {
return
request
(
payload
,
RequestMethods
.
POST
).
then
(
mapMerchantStaffListResponse
);
}
export
function
getDailyReportOverviewPage
(
data
=
{},
activeTabKey
=
"staffDaily"
)
{
export
function
getDailyReportMerchantBrandIds
(
merchantId
)
{
if
(
!
merchantId
)
{
return
Promise
.
resolve
([]);
}
if
(
USE_MOCK
)
{
return
Promise
.
resolve
([
3454
]);
}
const
payload
=
{
merchantId
,
currentPage
:
1
,
pageSize
:
1
,
method
:
"dj.staff.api.service.merchant.page.with.brand"
,
};
return
request
(
payload
,
RequestMethods
.
POST
)
.
then
(
res
=>
mapMerchantBrandContext
(
res
,
merchantId
));
}
export
function
getDailyReportOverviewPage
(
data
=
{},
activeTabKey
=
"storeDaily"
)
{
if
(
USE_MOCK
)
{
return
loadMock
().
then
(
(
m
)
=>
m
.
mockDailyReportOverviewPage
({
return
loadMock
().
then
(
m
=>
m
.
mockDailyReportOverviewPage
({
...
data
,
...
buildOverviewParams
(
data
,
activeTabKey
),
}));
...
...
@@ -81,11 +101,11 @@ export function getDailyReportOverviewPage(data = {}, activeTabKey = "staffDaily
export
function
getDailyReportDetailSelect
(
data
=
{})
{
if
(
USE_MOCK
)
{
return
loadMock
().
then
(
(
m
)
=>
m
.
mockDailyReportDetailSelect
(
data
));
return
loadMock
().
then
(
m
=>
m
.
mockDailyReportDetailSelect
(
data
));
}
const
payload
=
{
...
buildDetailSelectParams
(
data
),
method
:
`
${
path
}
dailyReport.detail.select`
,
};
return
request
(
payload
,
RequestMethods
.
POST
).
then
(
(
res
)
=>
mapDetailResponse
(
res
,
data
));
return
request
(
payload
,
RequestMethods
.
POST
).
then
(
res
=>
mapDetailResponse
(
res
,
data
));
}
src/views/residentManage/journalRecord/constants.js
View file @
bfe1277
...
...
@@ -5,9 +5,7 @@ import {
}
from
"./utils/journalDateTime"
;
export
const
JOURNAL_TABS
=
[
{
key
:
"staffDaily"
,
label
:
"驻店日报"
,
journalType
:
1
},
{
key
:
"storeDaily"
,
label
:
"门店日报"
,
journalType
:
2
},
{
key
:
"negotiation"
,
label
:
"洽谈明细"
,
journalType
:
3
},
];
export
const
BIZ_TYPE_TOOLTIP
=
"轻改:1.1精品升级、1.2次新车升配、1.3售后众筹;权益:2.1.1售前会员权益升级、2.1.2售后会员权益升级、2.3.1售前延保、2.3.2售后延保"
;
...
...
@@ -20,25 +18,21 @@ export const BIZ_TYPE_STYLE = {
};
export
const
TAB_TRACK_CODE_MAP
=
{
staffDaily
:
"journal_web_tab_click_staff_daily"
,
storeDaily
:
"journal_web_tab_click_store_daily"
,
negotiation
:
"journal_web_tab_click_negotiation_detail"
,
};
export
const
LIST_API_MAP
=
{
staffDaily
:
"getDailyReportOverviewPage"
,
storeDaily
:
"getDailyReportOverviewPage"
,
negotiation
:
"getDailyReportOverviewPage"
,
};
export
function
getTemplateTypeByTabKey
(
tabKey
)
{
const
tab
=
JOURNAL_TABS
.
find
(
item
=>
item
.
key
===
tabKey
);
return
tab
?.
journalType
??
1
;
return
tab
?.
journalType
??
2
;
}
export
function
getTabKeyByTemplateType
(
templateType
)
{
const
tab
=
JOURNAL_TABS
.
find
(
item
=>
item
.
journalType
===
templateType
);
return
tab
?.
key
??
"st
aff
Daily"
;
return
tab
?.
key
??
"st
ore
Daily"
;
}
export
{
formatJournalDate
,
formatJournalDateTime
}
from
"./utils/journalDateTime"
;
...
...
@@ -77,13 +71,6 @@ function createEmptyTextColumn(label, prop, options = {}) {
}
export
const
TABLE_COLUMNS_MAP
=
{
staffDaily
:
[
{
label
:
"驻店人员"
,
prop
:
"staffName"
,
minWidth
:
"100px"
,
showOverFlow
:
true
},
bizTypeColumn
,
{
label
:
"所属门店"
,
prop
:
"merchantName"
,
minWidth
:
"160px"
,
showOverFlow
:
true
,
align
:
"center"
},
createEmptyTextColumn
(
"今日出勤"
,
"attendanceStatus"
,
{
width
:
"100px"
}),
createDateTimeColumn
(
"最近保存时间"
,
"lastSaveTime"
),
],
storeDaily
:
[
{
label
:
"所属门店"
,
...
...
@@ -107,22 +94,14 @@ export const TABLE_COLUMNS_MAP = {
showOverFlow
:
true
,
}),
],
negotiation
:
[
{
label
:
"驻店人员"
,
prop
:
"staffName"
,
minWidth
:
"100px"
,
showOverFlow
:
true
},
bizTypeColumn
,
{
label
:
"所属门店"
,
prop
:
"merchantName"
,
minWidth
:
"160px"
,
showOverFlow
:
true
,
align
:
"center"
},
createDateTimeColumn
(
"最近保存时间"
,
"lastSaveTime"
),
],
};
export
function
getDetailTitle
(
detail
,
journalType
)
{
const
{
staffName
,
merchantName
,
reportDate
}
=
detail
;
const
{
merchantName
,
reportDate
}
=
detail
;
const
formattedDate
=
formatJournalDate
(
reportDate
);
const
dateText
=
formattedDate
!==
JOURNAL_EMPTY_TEXT
?
`(
${
formattedDate
}
)`
:
""
;
const
titleMap
=
{
staffDaily
:
`
${
staffName
}
的驻店日报
${
dateText
}
`
,
storeDaily
:
`
${
merchantName
}
的门店日报
${
dateText
}
`
,
negotiation
:
`
${
staffName
}
的洽谈明细
${
dateText
}
`
,
};
return
titleMap
[
journalType
]
||
""
;
}
src/views/residentManage/journalRecord/detail.vue
View file @
bfe1277
...
...
@@ -20,11 +20,21 @@
</
template
>
<
script
>
import
{
getDailyReportDetailSelect
,
getDailyReportMerchantBrandIds
,
}
from
"@api/journalRecord"
;
import
VenusBackButton
from
"@/components/venusBackButton/index.vue"
;
import
{
getDailyReportDetailSelect
}
from
"@api/journalRecord"
;
import
BizTypeTag
from
"./components/BizTypeTag.vue"
;
import
DynamicFormReadonly
from
"./components/DynamicFormReadonly.vue"
;
import
{
getDetailTitle
}
from
"./constants"
;
import
{
isStoreDailyJournalType
,
isStoreDailyTemplateType
,
normalizeJournalListQuery
,
STORE_DAILY_TAB_KEY
,
STORE_DAILY_TEMPLATE_TYPE
,
}
from
"./utils/journalAccess"
;
export
default
{
name
:
"JournalDetail"
,
...
...
@@ -49,6 +59,24 @@ export default {
this
.
fetchDetail
();
},
methods
:
{
async
resolveDetailBrandIds
(
detail
,
merchantId
)
{
if
(
Array
.
isArray
(
detail
.
brandIds
)
&&
detail
.
brandIds
.
length
)
{
return
detail
.
brandIds
;
}
try
{
return
await
getDailyReportMerchantBrandIds
(
detail
.
merchantId
||
merchantId
);
}
catch
(
error
)
{
console
.
error
(
"[JournalDetail] merchant brand query failed"
,
error
);
return
[];
}
},
redirectDisabledJournal
(
reportDate
)
{
this
.
$message
.
warning
(
"该汇报类型已停用"
);
this
.
$router
.
replace
({
name
:
"journalRecord"
,
query
:
normalizeJournalListQuery
({
reportDate
}),
});
},
async
fetchDetail
()
{
const
{
id
,
...
...
@@ -57,11 +85,17 @@ export default {
merchantId
,
staffUuid
,
sceneType
,
baseSceneCode
,
brandIds
,
}
=
this
.
$route
.
query
;
if
(
!
isStoreDailyJournalType
(
journalType
))
{
this
.
redirectDisabledJournal
(
reportDate
);
return
;
}
if
(
!
id
)
{
return
;
}
this
.
journalType
=
journalType
;
this
.
journalType
=
STORE_DAILY_TAB_KEY
;
this
.
pageLoading
=
true
;
try
{
const
res
=
await
getDailyReportDetailSelect
({
...
...
@@ -71,9 +105,18 @@ export default {
merchantId
,
staffUuid
,
sceneType
,
baseSceneCode
,
brandIds
,
templateType
:
STORE_DAILY_TEMPLATE_TYPE
,
});
if
(
!
isStoreDailyTemplateType
(
res
.
templateType
))
{
this
.
redirectDisabledJournal
(
reportDate
);
return
;
}
const
resolvedBrandIds
=
await
this
.
resolveDetailBrandIds
(
res
,
merchantId
);
this
.
detail
=
{
...
res
,
brandIds
:
resolvedBrandIds
,
reportDate
:
res
.
reportDate
||
reportDate
,
};
}
finally
{
...
...
src/views/residentManage/journalRecord/index.vue
View file @
bfe1277
...
...
@@ -14,21 +14,20 @@
</div>
<div
class=
"journal-record__search"
>
<d2-search
ref=
"showSearch"
class=
"show-search"
<d2-search
class=
"show-search"
:form-data=
"currentFormData"
:label-width=
"labelWidth"
:search-form=
"searchForm"
>
<template
slot=
"merchantHtml"
>
<el-select
v-model=
"searchForm.merchantId"
v-el-select-loadmore=
"loadMoreMerchants"
placeholder=
"请输入门店名称搜索"
style=
"width: 100%;"
clearable
filterable
:loading=
"merchantLoading"
placeholder=
"请输入门店名称搜索"
remote
reserve-keyword
style=
"width: 100%;
"
:loading=
"merchantLoading
"
:remote-method=
"remoteMerchantMethod"
@
change=
"handleMerchantChange"
@
visible-change=
"handleMerchantVisibleChange"
>
...
...
@@ -52,8 +51,8 @@
</div>
</div>
<d2-table
ref=
"journalTable
"
:key=
"activeTab
"
<d2-table
:key=
"activeTab
"
ref=
"journalTable
"
:before-search-fn=
"beforeSearchFn"
:get-list-api=
"currentListApi"
:has-num=
"false"
...
...
@@ -76,13 +75,13 @@
</template>
<
script
>
import
dayjs
from
"dayjs"
;
import
{
deepClone
}
from
"@/common/util"
;
import
reportTrackFunMixin
from
"@/mixins/reportTrackFunMixin"
;
import
{
getDailyReportMerchantListPage
,
getDailyReportOverviewPage
,
}
from
"@api/journalRecord"
;
import
dayjs
from
"dayjs"
;
import
{
deepClone
}
from
"@/common/util"
;
import
reportTrackFunMixin
from
"@/mixins/reportTrackFunMixin"
;
import
BizTypeTag
from
"./components/BizTypeTag.vue"
;
import
DateNav
from
"./components/DateNav.vue"
;
import
{
...
...
@@ -90,6 +89,10 @@ import {
TAB_TRACK_CODE_MAP
,
TABLE_COLUMNS_MAP
,
}
from
"./constants"
;
import
{
normalizeJournalListQuery
,
STORE_DAILY_TAB_KEY
,
}
from
"./utils/journalAccess"
;
const
DEFAULT_SEARCH_FORM
=
{
merchantId
:
""
,
...
...
@@ -127,7 +130,7 @@ export default {
return
{
labelWidth
:
"90px"
,
tabList
:
JOURNAL_TABS
,
activeTab
:
"staffDaily"
,
activeTab
:
STORE_DAILY_TAB_KEY
,
reportDate
:
dayjs
().
format
(
"YYYY-MM-DD"
),
searchForm
:
deepClone
(
DEFAULT_SEARCH_FORM
),
searchFormSearch
:
{},
...
...
@@ -146,27 +149,17 @@ export default {
name
:
"merchantId"
,
addHtml
:
"merchantHtml"
,
},
{
label
:
"驻店人员"
,
name
:
"staffName"
,
type
:
"input"
,
isClear
:
true
,
placeholder
:
"请输入"
,
},
],
};
},
computed
:
{
currentListApi
()
{
return
(
params
)
=>
getDailyReportOverviewPage
({
return
params
=>
getDailyReportOverviewPage
({
...
params
,
reportDate
:
params
.
reportDate
||
this
.
reportDate
,
},
this
.
activeTab
);
},
currentFormData
()
{
if
(
this
.
activeTab
===
"storeDaily"
)
{
return
this
.
baseFormData
.
filter
((
item
)
=>
item
.
name
===
"merchantId"
);
}
return
this
.
baseFormData
;
},
tableParams
()
{
...
...
@@ -186,10 +179,8 @@ export default {
},
methods
:
{
restoreStateFromRoute
()
{
const
{
journalType
,
reportDate
}
=
this
.
$route
.
query
;
if
(
journalType
&&
this
.
tabList
.
some
((
item
)
=>
item
.
key
===
journalType
))
{
this
.
activeTab
=
journalType
;
}
const
{
reportDate
}
=
this
.
$route
.
query
;
this
.
activeTab
=
STORE_DAILY_TAB_KEY
;
if
(
reportDate
&&
dayjs
(
reportDate
).
isValid
())
{
this
.
reportDate
=
reportDate
;
}
...
...
@@ -202,15 +193,15 @@ export default {
return
;
}
this
.
$router
.
replace
({
query
:
{
query
:
normalizeJournalListQuery
(
{
...
this
.
$route
.
query
,
journalType
:
this
.
activeTab
,
reportDate
:
this
.
reportDate
,
},
}
)
,
});
},
async
initPage
()
{
this
.
restoreStateFromRoute
();
this
.
syncRouteQuery
();
this
.
setReportTrackData
(
0
,
"journal_web_page_entry"
,
{});
this
.
handleSearch
();
},
...
...
@@ -273,7 +264,7 @@ export default {
return
;
}
this
.
selectedMerchant
=
this
.
baseData
.
storeOptions
.
find
(
(
item
)
=>
item
.
merchantId
===
merchantId
,
item
=>
item
.
merchantId
===
merchantId
,
)
||
this
.
selectedMerchant
;
},
resetMerchantSearch
()
{
...
...
@@ -341,6 +332,8 @@ export default {
merchantId
:
row
.
merchantId
,
staffUuid
:
row
.
staffUuid
,
sceneType
:
row
.
sceneType
,
baseSceneCode
:
row
.
baseSceneCode
,
brandIds
:
row
.
brandIds
,
},
});
}
...
...
src/views/residentManage/journalRecord/utils/journalAccess.js
0 → 100644
View file @
bfe1277
export
const
STORE_DAILY_TAB_KEY
=
"storeDaily"
;
export
const
STORE_DAILY_TEMPLATE_TYPE
=
2
;
export
function
isStoreDailyJournalType
(
journalType
)
{
return
journalType
===
STORE_DAILY_TAB_KEY
;
}
export
function
isStoreDailyTemplateType
(
templateType
)
{
return
templateType
==
null
||
Number
(
templateType
)
===
STORE_DAILY_TEMPLATE_TYPE
;
}
export
function
normalizeJournalListQuery
(
query
=
{})
{
return
{
...
query
,
journalType
:
STORE_DAILY_TAB_KEY
,
};
}
src/views/residentManage/journalRecord/utils/journalFormEcho.js
View file @
bfe1277
...
...
@@ -7,7 +7,7 @@ import { filterFormListForDisplay } from "./journalFormVisibility";
const
EMPTY_TEXT
=
"—"
;
function
sortBySortNum
(
list
=
[])
{
return
[
...
list
].
sort
((
a
,
b
)
=>
String
(
a
.
sortNum
||
""
).
localeCompare
(
String
(
b
.
sortNum
||
""
),
undefined
,
{
numeric
:
true
}));
return
[
...
list
].
sort
((
a
,
b
)
=>
String
(
a
.
sortNum
||
""
).
localeCompare
(
String
(
b
.
sortNum
||
""
),
undefined
,
{
numeric
:
true
}));
}
function
parseJsonContent
(
jsonContent
)
{
...
...
@@ -38,7 +38,7 @@ function mergeSchemaWithFieldDataList(schemaList = [], fieldDataList = []) {
valueMap
[
item
.
fieldKey
]
=
item
.
fieldValue
;
}
});
return
schemaList
.
map
(
(
field
)
=>
({
return
schemaList
.
map
(
field
=>
({
...
field
,
value
:
valueMap
[
field
.
key
]
!==
undefined
?
valueMap
[
field
.
key
]
:
field
.
value
,
}));
...
...
@@ -69,7 +69,7 @@ function hasSubformRowData(value) {
if
(
!
Array
.
isArray
(
value
)
||
!
value
.
length
)
{
return
false
;
}
return
value
.
some
(
(
row
)
=>
Array
.
isArray
(
row
)
&&
row
.
length
);
return
value
.
some
(
row
=>
Array
.
isArray
(
row
)
&&
row
.
length
);
}
function
normalizeSubformField
(
field
=
{})
{
...
...
@@ -81,7 +81,7 @@ function normalizeSubformField(field = {}) {
if
(
!
hasSubformRowData
(
value
)
&&
Array
.
isArray
(
field
.
childrenValue
)
&&
field
.
childrenValue
.
length
)
{
value
=
field
.
childrenValue
.
map
((
rowEntry
)
=>
{
const
rowData
=
extractSubformRowData
(
rowEntry
,
field
.
key
);
return
template
.
map
(
(
col
)
=>
({
return
template
.
map
(
col
=>
({
...
col
,
value
:
rowData
[
col
.
key
],
}));
...
...
@@ -89,13 +89,13 @@ function normalizeSubformField(field = {}) {
}
return
{
...
field
,
children
:
template
.
length
?
[
template
]
:
field
.
children
,
children
:
template
.
length
?
[
template
]
:
field
.
children
,
value
,
};
}
function
normalizeFormList
(
formList
=
[])
{
return
formList
.
map
(
(
field
)
=>
normalizeSubformField
(
field
));
return
formList
.
map
(
field
=>
normalizeSubformField
(
field
));
}
/**
...
...
@@ -113,7 +113,14 @@ function findOptionLabel(options = [], value) {
if
(
value
==
null
||
value
===
""
)
{
return
""
;
}
const
hit
=
(
options
||
[]).
find
((
item
)
=>
String
(
item
.
value
)
===
String
(
value
));
const
valueAliases
=
typeof
value
===
"object"
?
[
value
.
value
,
value
.
id
].
filter
(
alias
=>
alias
!=
null
&&
alias
!==
""
).
map
(
String
)
:
[
String
(
value
)];
const
hit
=
(
options
||
[]).
find
(
item
=>
[
item
.
value
,
item
.
id
]
.
filter
(
alias
=>
alias
!=
null
&&
alias
!==
""
)
.
map
(
String
)
.
some
(
alias
=>
valueAliases
.
includes
(
alias
)));
return
hit
?.
label
??
""
;
}
...
...
@@ -130,14 +137,14 @@ function formatCarBrandValue(raw) {
raw
.
vehicleSubBrandName
,
raw
.
vehicleSeriesName
,
raw
.
vehicleShapeName
,
].
filter
(
(
part
)
=>
part
!=
null
&&
part
!==
""
);
].
filter
(
part
=>
part
!=
null
&&
part
!==
""
);
return
parts
.
length
?
parts
.
join
(
" / "
)
:
EMPTY_TEXT
;
}
return
String
(
raw
);
}
function
isLabelValueObject
(
raw
)
{
return
raw
!=
null
&&
typeof
raw
===
"object"
&&
!
Array
.
isArray
(
raw
)
&&
"text"
in
raw
;
return
raw
!=
null
&&
typeof
raw
===
"object"
&&
!
Array
.
isArray
(
raw
);
}
function
resolveLabelValueRaw
(
raw
,
type
)
{
...
...
@@ -147,6 +154,12 @@ function resolveLabelValueRaw(raw, type) {
if
(
raw
.
text
!=
null
&&
raw
.
text
!==
""
)
{
return
raw
.
text
;
}
if
(
raw
.
name
!=
null
&&
raw
.
name
!==
""
)
{
return
raw
.
name
;
}
if
(
raw
.
label
!=
null
&&
raw
.
label
!==
""
)
{
return
raw
.
label
;
}
if
(
type
===
"carBrandSelect"
&&
raw
.
value
!=
null
)
{
return
formatCarBrandValue
(
raw
.
value
);
}
...
...
@@ -169,6 +182,10 @@ export function formatEchoValue(field = {}) {
switch
(
type
)
{
case
"radio"
:
case
"select"
:
{
const
optionLabel
=
findOptionLabel
(
options
,
raw
);
if
(
optionLabel
)
{
return
optionLabel
;
}
const
displayRaw
=
resolveLabelValueRaw
(
raw
,
type
);
if
(
displayRaw
!==
raw
)
{
return
String
(
displayRaw
);
...
...
@@ -176,8 +193,12 @@ export function formatEchoValue(field = {}) {
return
findOptionLabel
(
options
,
raw
)
||
String
(
raw
);
}
case
"multipleSelect"
:
{
const
list
=
Array
.
isArray
(
raw
)
?
raw
:
[
raw
];
const
list
=
Array
.
isArray
(
raw
)
?
raw
:
[
raw
];
const
labels
=
list
.
map
((
item
)
=>
{
const
optionLabel
=
findOptionLabel
(
options
,
item
);
if
(
optionLabel
)
{
return
optionLabel
;
}
const
displayItem
=
resolveLabelValueRaw
(
item
,
"select"
);
if
(
displayItem
!==
item
)
{
return
String
(
displayItem
);
...
...
@@ -282,7 +303,7 @@ export function buildSubformTable(field = {}) {
const
template
=
getSubformTemplate
(
field
);
const
rowFieldsList
=
Array
.
isArray
(
field
.
value
)
?
field
.
value
:
[];
const
columns
=
template
.
map
(
(
col
)
=>
({
const
columns
=
template
.
map
(
col
=>
({
prop
:
col
.
key
,
label
:
col
.
label
||
col
.
key
,
minWidth
:
"120px"
,
...
...
src/views/residentManage/journalRecord/utils/journalFormVisibility/groupShowRuleEval.js
View file @
bfe1277
function
evalPart
(
part
=
""
,
ctx
=
{})
{
const
trimmed
=
part
.
trim
();
const
eqMatch
=
trimmed
.
match
(
/^val
(\d
+
)\s
*==
\s
*
(?:
'
([^
'
]
*
)
'|"
([^
"
]
*
)
"
)
$/
);
if
(
eqMatch
)
{
const
actual
=
ctx
[
`val
${
eqMatch
[
1
]}
`
];
const
expected
=
eqMatch
[
2
]
!=
null
?
eqMatch
[
2
]
:
eqMatch
[
3
];
return
actual
==
expected
;
function
tokenize
(
expr
=
""
)
{
const
tokens
=
[];
let
index
=
0
;
while
(
index
<
expr
.
length
)
{
const
char
=
expr
[
index
];
if
(
/
\s
/
.
test
(
char
))
{
index
+=
1
;
continue
;
}
const
pair
=
expr
.
slice
(
index
,
index
+
2
);
if
([
"&&"
,
"||"
,
"=="
,
"!="
].
includes
(
pair
))
{
tokens
.
push
({
type
:
"operator"
,
value
:
pair
});
index
+=
2
;
continue
;
}
if
([
"!"
,
"("
,
")"
].
includes
(
char
))
{
tokens
.
push
({
type
:
"operator"
,
value
:
char
});
index
+=
1
;
continue
;
}
if
(
char
===
"'"
||
char
===
"\""
)
{
const
quote
=
char
;
let
value
=
""
;
let
closed
=
false
;
index
+=
1
;
while
(
index
<
expr
.
length
)
{
const
current
=
expr
[
index
];
if
(
current
===
quote
)
{
closed
=
true
;
index
+=
1
;
break
;
}
if
(
current
===
"\\"
&&
index
+
1
<
expr
.
length
)
{
const
escaped
=
expr
[
index
+
1
];
const
escapeMap
=
{
n
:
"\n"
,
r
:
"\r"
,
t
:
"\t"
};
value
+=
escapeMap
[
escaped
]
??
escaped
;
index
+=
2
;
continue
;
}
value
+=
current
;
index
+=
1
;
}
if
(
!
closed
)
{
throw
new
Error
(
"unterminated string"
);
}
tokens
.
push
({
type
:
"string"
,
value
});
continue
;
}
const
identifier
=
expr
.
slice
(
index
).
match
(
/^
[
A-Z_$
][\w
$
]
*
(?:\.[
A-Z_$
][\w
$
]
*
)
*/i
);
if
(
identifier
)
{
tokens
.
push
({
type
:
"identifier"
,
value
:
identifier
[
0
]
});
index
+=
identifier
[
0
].
length
;
continue
;
}
throw
new
Error
(
`unsupported token at
${
index
}
`
);
}
const
neNullMatch
=
trimmed
.
match
(
/^val
(\d
+
)\s
*!=
\s
*null$/
);
if
(
neNullMatch
)
{
const
actual
=
ctx
[
`val
${
neNullMatch
[
1
]}
`
];
return
actual
!=
null
&&
actual
!==
""
;
return
tokens
;
}
function
parseExpression
(
tokens
=
[],
ctx
=
{})
{
let
index
=
0
;
const
peek
=
()
=>
tokens
[
index
];
const
take
=
()
=>
tokens
[
index
++
];
const
match
=
(
value
)
=>
{
if
(
peek
()?.
value
!==
value
)
{
return
false
;
}
index
+=
1
;
return
true
;
};
const
expect
=
(
value
)
=>
{
if
(
!
match
(
value
))
{
throw
new
Error
(
`expected
${
value
}
`
);
}
};
const
expectType
=
(
type
)
=>
{
const
token
=
take
();
if
(
!
token
||
token
.
type
!==
type
)
{
throw
new
Error
(
`expected
${
type
}
`
);
}
return
token
.
value
;
};
const
resolveVal
=
(
name
)
=>
{
if
(
!
/^val
\d
+$/
.
test
(
name
))
{
throw
new
Error
(
`unsupported variable
${
name
}
`
);
}
return
ctx
[
name
];
};
let
parseOr
;
const
parsePrimary
=
()
=>
{
if
(
match
(
"("
))
{
const
value
=
parseOr
();
expect
(
")"
);
return
value
;
}
const
identifier
=
expectType
(
"identifier"
);
if
(
identifier
===
"Array.isArray"
)
{
expect
(
"("
);
const
variable
=
expectType
(
"identifier"
);
expect
(
")"
);
return
Array
.
isArray
(
resolveVal
(
variable
));
}
if
(
/^val
\d
+
\.
includes$/
.
test
(
identifier
))
{
const
variable
=
identifier
.
slice
(
0
,
identifier
.
indexOf
(
"."
));
expect
(
"("
);
const
expected
=
expectType
(
"string"
);
expect
(
")"
);
const
actual
=
resolveVal
(
variable
);
return
Array
.
isArray
(
actual
)
&&
actual
.
includes
(
expected
);
}
if
(
/^val
\d
+$/
.
test
(
identifier
))
{
if
(
!
[
"=="
,
"!="
].
includes
(
peek
()?.
value
))
{
return
Boolean
(
resolveVal
(
identifier
));
}
const
operator
=
take
()?.
value
;
const
expectedToken
=
take
();
if
(
!
expectedToken
)
{
throw
new
Error
(
"missing comparison value"
);
}
const
actual
=
resolveVal
(
identifier
);
if
(
expectedToken
.
type
===
"identifier"
&&
expectedToken
.
value
===
"null"
)
{
const
isEmpty
=
actual
==
null
||
actual
===
""
;
return
operator
===
"!="
?
!
isEmpty
:
isEmpty
;
}
if
(
expectedToken
.
type
!==
"string"
)
{
throw
new
Error
(
"unsupported comparison value"
);
}
const
equals
=
String
(
actual
)
===
expectedToken
.
value
;
return
operator
===
"=="
?
equals
:
!
equals
;
}
throw
new
Error
(
`unsupported expression
${
identifier
}
`
);
};
const
parseUnary
=
()
=>
(
match
(
"!"
)
?
!
parseUnary
()
:
parsePrimary
());
const
parseAnd
=
()
=>
{
let
value
=
parseUnary
();
while
(
match
(
"&&"
))
{
const
right
=
parseUnary
();
value
=
value
&&
right
;
}
return
value
;
};
parseOr
=
()
=>
{
let
value
=
parseAnd
();
while
(
match
(
"||"
))
{
const
right
=
parseAnd
();
value
=
value
||
right
;
}
return
value
;
};
const
result
=
parseOr
();
if
(
index
!==
tokens
.
length
)
{
throw
new
Error
(
"unexpected trailing expression"
);
}
return
false
;
return
result
;
}
function
fallbackEvaluate
(
expr
=
""
,
ctx
=
{})
{
export
function
fallbackEvaluate
(
expr
=
""
,
ctx
=
{})
{
if
(
!
expr
)
{
return
true
;
}
return
expr
.
split
(
"&&"
).
every
((
part
)
=>
evalPart
(
part
,
ctx
));
try
{
return
parseExpression
(
tokenize
(
expr
),
ctx
);
}
catch
(
error
)
{
return
false
;
}
}
export
function
evaluateShowRule
(
keys
=
[],
resultExpr
=
""
,
rowFields
=
[],
getRowFieldValue
)
{
...
...
@@ -27,8 +176,8 @@ export function evaluateShowRule(keys = [], resultExpr = "", rowFields = [], get
}
try
{
const
ctx
=
{};
keys
.
forEach
((
key
,
i
ndex
)
=>
{
ctx
[
`val
${
i
ndex
+
1
}
`
]
=
getRowFieldValue
(
rowFields
,
key
);
keys
.
forEach
((
key
,
keyI
ndex
)
=>
{
ctx
[
`val
${
keyI
ndex
+
1
}
`
]
=
getRowFieldValue
(
rowFields
,
key
);
});
return
fallbackEvaluate
(
resultExpr
,
ctx
);
}
catch
(
error
)
{
...
...
src/views/residentManage/journalRecord/utils/journalFormVisibility/groupVisibility.js
View file @
bfe1277
import
{
evaluateShowRule
}
from
"./groupShowRuleEval"
;
import
{
getEffectiveSceneCodes
}
from
"./visibilityHelpers"
;
function
getRowFieldValue
(
rowFields
=
[],
key
=
""
,
rowMap
=
null
)
{
const
field
=
(
rowFields
||
[]).
find
((
item
)
=>
item
.
key
===
key
);
function
resolveStaticOptionValue
(
field
=
{},
raw
=
{})
{
const
aliases
=
[
raw
.
value
,
raw
.
id
]
.
filter
(
value
=>
value
!=
null
&&
value
!==
""
)
.
map
(
String
);
if
(
!
aliases
.
length
)
{
return
null
;
}
const
option
=
(
field
.
options
||
[]).
find
(
item
=>
[
item
.
value
,
item
.
id
]
.
filter
(
value
=>
value
!=
null
&&
value
!==
""
)
.
map
(
String
)
.
some
(
alias
=>
aliases
.
includes
(
alias
)));
return
option
?.
value
??
option
?.
label
??
null
;
}
function
normalizeRuleScalar
(
raw
,
field
=
{})
{
if
(
raw
==
null
||
raw
===
""
)
{
return
null
;
}
if
(
typeof
raw
!==
"object"
)
{
return
raw
;
}
const
staticValue
=
resolveStaticOptionValue
(
field
,
raw
);
if
(
staticValue
!=
null
&&
staticValue
!==
""
)
{
return
staticValue
;
}
return
raw
.
name
??
raw
.
label
??
raw
.
text
??
raw
.
value
??
raw
.
id
??
null
;
}
function
normalizeRuleValue
(
raw
,
field
=
{})
{
if
(
Array
.
isArray
(
raw
))
{
return
raw
.
map
(
item
=>
normalizeRuleScalar
(
item
,
field
)).
filter
(
value
=>
value
!=
null
);
}
return
normalizeRuleScalar
(
raw
,
field
);
}
function
findGroupChild
(
group
=
{},
key
=
""
)
{
const
children
=
Array
.
isArray
(
group
.
children
)
?
group
.
children
:
[];
const
fields
=
Array
.
isArray
(
children
[
0
])
?
children
.
flat
()
:
children
;
return
fields
.
find
(
item
=>
item
?.
key
===
key
);
}
function
getRowFieldValue
(
rowFields
=
[],
key
=
""
,
rowMap
=
null
,
pageContext
=
{},
group
=
{},
)
{
if
(
key
===
"$sceneCodes"
)
{
return
getEffectiveSceneCodes
(
pageContext
).
map
(
String
);
}
if
(
key
===
"$brandIds"
)
{
return
(
pageContext
.
brandIds
||
[]).
map
(
String
);
}
const
field
=
(
rowFields
||
[]).
find
(
item
=>
item
.
key
===
key
);
const
fieldMeta
=
findGroupChild
(
group
,
key
);
if
(
field
)
{
if
(
field
.
value
!=
null
&&
field
.
value
!==
""
)
{
return
field
.
value
;
return
normalizeRuleValue
(
field
.
value
,
{
...
fieldMeta
,
...
field
})
;
}
const
metaKey
=
field
.
key
;
if
(
metaKey
!=
null
&&
field
[
metaKey
]
!=
null
&&
field
[
metaKey
]
!==
""
)
{
const
meta
=
field
[
metaKey
];
if
(
typeof
meta
===
"object"
&&
!
Array
.
isArray
(
meta
))
{
return
meta
.
name
??
meta
.
label
??
meta
.
id
??
meta
;
}
return
meta
;
return
normalizeRuleValue
(
meta
,
{
...
fieldMeta
,
...
field
});
}
}
if
(
rowMap
&&
rowMap
[
key
]
!=
null
&&
rowMap
[
key
]
!==
""
)
{
return
rowMap
[
key
]
;
return
normalizeRuleValue
(
rowMap
[
key
])
;
}
return
null
;
}
function
isGroupChildVisibleInRow
(
group
=
{},
child
=
{},
rowFields
=
[],
rowMap
=
null
)
{
function
isGroupChildVisibleInRow
(
group
=
{},
child
=
{},
rowFields
=
[],
rowMap
=
null
,
pageContext
=
{},
)
{
const
rules
=
group
.
childrenShowRules
;
if
(
!
rules
||
!
child
?.
key
)
{
return
true
;
...
...
@@ -36,10 +95,15 @@ function isGroupChildVisibleInRow(group = {}, child = {}, rowFields = [], rowMap
return
true
;
}
return
evaluateShowRule
(
keys
,
resultExpr
,
rowFields
,
(
rf
,
k
)
=>
getRowFieldValue
(
rf
,
k
,
rowMap
));
getRowFieldValue
(
rf
,
k
,
rowMap
,
pageContext
,
group
));
}
export
function
filterVisibleRowFields
(
group
=
{},
rowFields
=
[],
rowMap
=
null
)
{
return
(
rowFields
||
[]).
filter
((
field
)
=>
isGroupChildVisibleInRow
(
group
,
field
,
rowFields
,
rowMap
));
export
function
filterVisibleRowFields
(
group
=
{},
rowFields
=
[],
rowMap
=
null
,
pageContext
=
{},
)
{
return
(
rowFields
||
[]).
filter
(
field
=>
isGroupChildVisibleInRow
(
group
,
field
,
rowFields
,
rowMap
,
pageContext
));
}
src/views/residentManage/journalRecord/utils/journalFormVisibility/index.js
View file @
bfe1277
...
...
@@ -17,15 +17,15 @@ import {
import
{
isFieldVisibleBySpecs
}
from
"./visibilitySpecs"
;
function
sortBySortNum
(
list
=
[])
{
return
[
...
list
].
sort
((
a
,
b
)
=>
return
[
...
list
].
sort
((
a
,
b
)
=>
String
(
a
.
sortNum
||
""
).
localeCompare
(
String
(
b
.
sortNum
||
""
),
undefined
,
{
numeric
:
true
}));
}
function
getEchoKeysFromFormList
(
formList
=
[])
{
const
echoSubformKeys
=
formList
.
filter
(
(
item
)
=>
item
?.
key
&&
(
item
.
type
===
"subform"
||
item
.
type
===
"group"
))
.
map
(
(
item
)
=>
item
.
key
);
const
echoTopLevelKeys
=
formList
.
filter
(
(
item
)
=>
item
?.
key
).
map
((
item
)
=>
item
.
key
);
.
filter
(
item
=>
item
?.
key
&&
(
item
.
type
===
"subform"
||
item
.
type
===
"group"
))
.
map
(
item
=>
item
.
key
);
const
echoTopLevelKeys
=
formList
.
filter
(
item
=>
item
?.
key
).
map
(
item
=>
item
.
key
);
return
{
echoSubformKeys
,
echoTopLevelKeys
};
}
...
...
@@ -98,8 +98,8 @@ function getVisibleSubformChildren(group, ctx, values, schemaList = [], formList
echoParentKey
:
group
?.
key
,
};
return
getSubformRowTemplate
(
group
)
.
map
(
(
child
)
=>
mergeFieldMeta
(
child
,
schemaList
,
formList
))
.
filter
(
(
child
)
=>
isFieldVisibleBySpecs
(
child
,
ctx
,
values
,
visibilityOptions
))
.
map
(
child
=>
mergeFieldMeta
(
child
,
schemaList
,
formList
))
.
filter
(
child
=>
isFieldVisibleBySpecs
(
child
,
ctx
,
values
,
visibilityOptions
))
.
sort
((
a
,
b
)
=>
Number
(
a
.
sortNum
)
-
Number
(
b
.
sortNum
));
}
...
...
@@ -112,8 +112,8 @@ function getVisibleGroupChildren(group, ctx, values, schemaList = [], formList =
echoParentKey
:
group
?.
key
,
};
return
getStaticGroupChildren
(
group
)
.
map
(
(
child
)
=>
mergeFieldMeta
(
child
,
schemaList
,
formList
))
.
filter
(
(
child
)
=>
isFieldVisibleBySpecs
(
child
,
ctx
,
values
,
visibilityOptions
))
.
map
(
child
=>
mergeFieldMeta
(
child
,
schemaList
,
formList
))
.
filter
(
child
=>
isFieldVisibleBySpecs
(
child
,
ctx
,
values
,
visibilityOptions
))
.
sort
((
a
,
b
)
=>
Number
(
a
.
sortNum
)
-
Number
(
b
.
sortNum
));
}
...
...
@@ -135,11 +135,11 @@ function filterFieldNode(field, schemaList, formList, ctx, values, options) {
return
null
;
}
const
childMap
=
new
Map
(
getStaticGroupChildren
(
merged
).
map
(
(
child
)
=>
[
child
.
key
,
child
]),
getStaticGroupChildren
(
merged
).
map
(
child
=>
[
child
.
key
,
child
]),
);
return
{
...
merged
,
children
:
visibleChildren
.
map
(
(
child
)
=>
({
children
:
visibleChildren
.
map
(
child
=>
({
...
child
,
...(
childMap
.
get
(
child
.
key
)
||
{}),
value
:
childMap
.
get
(
child
.
key
)?.
value
??
child
.
value
,
...
...
@@ -153,15 +153,15 @@ function filterFieldNode(field, schemaList, formList, ctx, values, options) {
return
null
;
}
const
templateMap
=
new
Map
(
getSubformRowTemplate
(
merged
).
map
(
(
col
)
=>
[
col
.
key
,
col
]),
getSubformRowTemplate
(
merged
).
map
(
col
=>
[
col
.
key
,
col
]),
);
const
mergedTemplate
=
visibleTemplate
.
map
(
(
col
)
=>
({
const
mergedTemplate
=
visibleTemplate
.
map
(
col
=>
({
...
col
,
...(
templateMap
.
get
(
col
.
key
)
||
{}),
}));
const
rowFieldsList
=
Array
.
isArray
(
merged
.
value
)
?
merged
.
value
:
[];
const
groupDef
=
mergeFieldMeta
(
merged
,
schemaList
,
formList
);
const
allowedKeys
=
new
Set
(
mergedTemplate
.
map
(
(
col
)
=>
col
.
key
));
const
allowedKeys
=
new
Set
(
mergedTemplate
.
map
(
col
=>
col
.
key
));
const
filteredRows
=
rowFieldsList
.
map
((
rowCells
)
=>
{
const
cells
=
Array
.
isArray
(
rowCells
)
?
rowCells
:
[];
...
...
@@ -171,10 +171,10 @@ function filterFieldNode(field, schemaList, formList, ctx, values, options) {
rowMap
[
cell
.
key
]
=
cell
.
value
;
}
});
const
visibleInRow
=
filterVisibleRowFields
(
groupDef
,
cells
,
rowMap
);
return
visibleInRow
.
filter
(
(
cell
)
=>
allowedKeys
.
has
(
cell
.
key
));
const
visibleInRow
=
filterVisibleRowFields
(
groupDef
,
cells
,
rowMap
,
ctx
);
return
visibleInRow
.
filter
(
cell
=>
allowedKeys
.
has
(
cell
.
key
));
})
.
filter
(
(
row
)
=>
row
.
length
);
.
filter
(
row
=>
row
.
length
);
return
{
...
merged
,
...
...
@@ -197,7 +197,7 @@ export function filterFormListForDisplay(formList = [], detail = {}) {
return
sortBySortNum
(
formList
.
map
(
(
field
)
=>
filterFieldNode
(
field
,
schemaList
,
formList
,
ctx
,
values
,
options
))
.
map
(
field
=>
filterFieldNode
(
field
,
schemaList
,
formList
,
ctx
,
values
,
options
))
.
filter
(
Boolean
),
);
}
...
...
tests/unit/api/adapters/journalRecord/mapDetailResponse.spec.js
0 → 100644
View file @
bfe1277
const
{
mapDetailResponse
}
=
require
(
"@/api/adapters/journalRecord/mapDetailResponse"
);
describe
(
"mapDetailResponse"
,
()
=>
{
it
(
"应保留接口返回的模板类型"
,
()
=>
{
expect
(
mapDetailResponse
({
templateType
:
2
}).
templateType
).
toBe
(
2
);
});
it
(
"接口缺少模板类型时使用调用上下文"
,
()
=>
{
expect
(
mapDetailResponse
({},
{
templateType
:
2
}).
templateType
).
toBe
(
2
);
});
it
(
"路由中的单个品牌应归一化成品牌数组"
,
()
=>
{
expect
(
mapDetailResponse
({},
{
brandIds
:
"3454"
}).
brandIds
).
toEqual
([
"3454"
]);
});
it
(
"接口缺少场景码时应保留路由上下文"
,
()
=>
{
expect
(
mapDetailResponse
({},
{
baseSceneCode
:
"100101"
}).
baseSceneCode
).
toBe
(
"100101"
);
});
});
tests/unit/api/adapters/journalRecord/mapMerchantBrandContext.spec.js
0 → 100644
View file @
bfe1277
const
{
mapMerchantBrandContext
,
}
=
require
(
"@/api/adapters/journalRecord/mapMerchantBrandContext"
);
describe
(
"mapMerchantBrandContext"
,
()
=>
{
it
(
"应从门店经营品牌列表提取子品牌 ID"
,
()
=>
{
expect
(
mapMerchantBrandContext
({
list
:
[{
merchantId
:
1001
,
merchantBrandList
:
[
{
brandId
:
1
,
childId
:
3454
},
{
brandId
:
2
,
childId
:
"3503"
},
],
}],
},
1001
)).
toEqual
([
3454
,
"3503"
]);
});
it
(
"没有匹配门店时返回空数组"
,
()
=>
{
expect
(
mapMerchantBrandContext
({
list
:
[]
},
1001
)).
toEqual
([]);
});
});
tests/unit/api/adapters/journalRecord/mapOverviewRow.spec.js
View file @
bfe1277
...
...
@@ -21,4 +21,15 @@ describe("mapOverviewRow", () => {
expect
(
row
.
bizTypeName
).
toBe
(
"权益"
);
expect
(
row
.
bizType
).
toBe
(
2
);
});
it
(
"应保留详情显隐需要的品牌和场景上下文"
,
()
=>
{
const
row
=
mapOverviewRow
({
brandIds
:
[
3454
,
3503
],
baseSceneCode
:
100101
,
sceneList
:
[{
baseSceneCode
:
100101
}],
});
expect
(
row
.
brandIds
).
toEqual
([
3454
,
3503
]);
expect
(
row
.
baseSceneCode
).
toBe
(
100101
);
expect
(
row
.
sceneList
).
toEqual
([{
baseSceneCode
:
100101
}]);
});
});
tests/unit/views/residentManage/journalRecord/constants.spec.js
0 → 100644
View file @
bfe1277
const
{
JOURNAL_TABS
,
TABLE_COLUMNS_MAP
,
getTabKeyByTemplateType
,
getTemplateTypeByTabKey
,
}
=
require
(
"@/views/residentManage/journalRecord/constants"
);
describe
(
"journalRecord constants"
,
()
=>
{
it
(
"人员管理仅保留门店日报"
,
()
=>
{
expect
(
JOURNAL_TABS
).
toEqual
([
{
key
:
"storeDaily"
,
label
:
"门店日报"
,
journalType
:
2
},
]);
expect
(
Object
.
keys
(
TABLE_COLUMNS_MAP
)).
toEqual
([
"storeDaily"
]);
expect
(
getTemplateTypeByTabKey
(
"staffDaily"
)).
toBe
(
2
);
expect
(
getTemplateTypeByTabKey
(
"storeDaily"
)).
toBe
(
2
);
expect
(
getTabKeyByTemplateType
(
1
)).
toBe
(
"storeDaily"
);
expect
(
getTabKeyByTemplateType
(
2
)).
toBe
(
"storeDaily"
);
});
});
tests/unit/views/residentManage/journalRecord/detail.spec.js
0 → 100644
View file @
bfe1277
jest
.
mock
(
"@api/journalRecord"
,
()
=>
({
getDailyReportDetailSelect
:
jest
.
fn
(),
getDailyReportMerchantBrandIds
:
jest
.
fn
(),
}));
const
{
getDailyReportDetailSelect
,
getDailyReportMerchantBrandIds
,
}
=
require
(
"@api/journalRecord"
);
const
Detail
=
require
(
"@/views/residentManage/journalRecord/detail.vue"
).
default
;
function
createContext
(
query
)
{
return
{
$route
:
{
query
},
$router
:
{
replace
:
jest
.
fn
()
},
$message
:
{
warning
:
jest
.
fn
()
},
journalType
:
""
,
pageLoading
:
false
,
detail
:
{},
resolveDetailBrandIds
(
detail
,
merchantId
)
{
return
Detail
.
methods
.
resolveDetailBrandIds
.
call
(
this
,
detail
,
merchantId
);
},
redirectDisabledJournal
(
reportDate
)
{
return
Detail
.
methods
.
redirectDisabledJournal
.
call
(
this
,
reportDate
);
},
};
}
describe
(
"journalDetail access"
,
()
=>
{
beforeEach
(()
=>
{
jest
.
clearAllMocks
();
});
it
.
each
([
"staffDaily"
,
"negotiation"
])(
"%s 旧详情应在接口请求前返回列表"
,
async
(
journalType
)
=>
{
const
context
=
createContext
({
id
:
"old-1"
,
journalType
,
reportDate
:
"2026-08-12"
,
});
await
Detail
.
methods
.
fetchDetail
.
call
(
context
);
expect
(
getDailyReportDetailSelect
).
not
.
toHaveBeenCalled
();
expect
(
context
.
$message
.
warning
).
toHaveBeenCalledWith
(
"该汇报类型已停用"
);
expect
(
context
.
$router
.
replace
).
toHaveBeenCalledWith
({
name
:
"journalRecord"
,
query
:
{
journalType
:
"storeDaily"
,
reportDate
:
"2026-08-12"
,
},
});
});
it
(
"门店日报详情请求应携带品牌和场景上下文"
,
async
()
=>
{
getDailyReportDetailSelect
.
mockResolvedValue
({
templateType
:
2
,
brandIds
:
[
"3454"
]
});
const
context
=
createContext
({
id
:
"store-1"
,
journalType
:
"storeDaily"
,
reportDate
:
"2026-08-12"
,
baseSceneCode
:
"100101"
,
brandIds
:
[
"3454"
],
});
await
Detail
.
methods
.
fetchDetail
.
call
(
context
);
expect
(
getDailyReportDetailSelect
).
toHaveBeenCalledWith
(
expect
.
objectContaining
({
baseSceneCode
:
"100101"
,
brandIds
:
[
"3454"
],
templateType
:
2
,
}));
});
it
(
"详情缺少品牌上下文时应按门店查询经营品牌"
,
async
()
=>
{
getDailyReportDetailSelect
.
mockResolvedValue
({
templateType
:
2
,
merchantId
:
"1001"
});
getDailyReportMerchantBrandIds
.
mockResolvedValue
([
3454
]);
const
context
=
createContext
({
id
:
"store-1"
,
journalType
:
"storeDaily"
,
merchantId
:
"1001"
,
});
await
Detail
.
methods
.
fetchDetail
.
call
(
context
);
expect
(
getDailyReportMerchantBrandIds
).
toHaveBeenCalledWith
(
"1001"
);
expect
(
context
.
detail
.
brandIds
).
toEqual
([
3454
]);
});
});
tests/unit/views/residentManage/journalRecord/groupShowRuleEval.spec.js
0 → 100644
View file @
bfe1277
const
{
evaluateShowRule
,
fallbackEvaluate
,
}
=
require
(
"@/views/residentManage/journalRecord/utils/journalFormVisibility/groupShowRuleEval"
);
describe
(
"groupShowRuleEval V2.3.0"
,
()
=>
{
const
deliveryDateRule
=
"val1 && Array.isArray(val1) && val2 && Array.isArray(val2) && (((val1.includes('100101') || val1.includes('100102') || val1.includes('100103')) && (val2.includes('3454') || val2.includes('3503')) && val3 == '交付端引流-售前') || ((val1.includes('100101') || val1.includes('100102') || val1.includes('100103')) && !(val2.includes('3454') || val2.includes('3503')) && (val3 == '销售端引流-售前' || val3 == '交付端引流-售前')) || ((val1.includes('110101') || val1.includes('110201')) && val3 == '门店引流-售前'))"
;
it
(
"应支持场景、品牌和客户来源组成的实际交付日期规则"
,
()
=>
{
expect
(
fallbackEvaluate
(
deliveryDateRule
,
{
val1
:
[
"100101"
],
val2
:
[
"3454"
],
val3
:
"交付端引流-售前"
,
})).
toBe
(
true
);
expect
(
fallbackEvaluate
(
deliveryDateRule
,
{
val1
:
[
"100101"
],
val2
:
[
"3454"
],
val3
:
"销售端引流-售前"
,
})).
toBe
(
false
);
expect
(
fallbackEvaluate
(
deliveryDateRule
,
{
val1
:
[
"100101"
],
val2
:
[
"3067"
],
val3
:
"销售端引流-售前"
,
})).
toBe
(
true
);
expect
(
fallbackEvaluate
(
deliveryDateRule
,
{
val1
:
[
"110201"
],
val2
:
[
"3454"
],
val3
:
"门店引流-售前"
,
})).
toBe
(
true
);
});
it
(
"应安全处理空值并拒绝不支持的语法"
,
()
=>
{
expect
(
fallbackEvaluate
(
"val1 && Array.isArray(val1) && val1.includes('已触客')"
,
{
val1
:
null
,
})).
toBe
(
false
);
expect
(
evaluateShowRule
([
"F2-107-7"
],
"window.alert('x')"
,
[],
()
=>
null
)).
toBe
(
false
);
});
});
tests/unit/views/residentManage/journalRecord/journalAccess.spec.js
0 → 100644
View file @
bfe1277
const
{
STORE_DAILY_TAB_KEY
,
STORE_DAILY_TEMPLATE_TYPE
,
isStoreDailyJournalType
,
isStoreDailyTemplateType
,
normalizeJournalListQuery
,
}
=
require
(
"@/views/residentManage/journalRecord/utils/journalAccess"
);
describe
(
"journalAccess"
,
()
=>
{
it
(
"旧列表链接应统一归一化到门店日报"
,
()
=>
{
expect
(
normalizeJournalListQuery
({
journalType
:
"staffDaily"
,
reportDate
:
"2026-08-12"
})).
toEqual
({
journalType
:
STORE_DAILY_TAB_KEY
,
reportDate
:
"2026-08-12"
,
});
expect
(
normalizeJournalListQuery
({
journalType
:
"negotiation"
}).
journalType
).
toBe
(
"storeDaily"
);
});
it
(
"详情仅允许门店日报类型"
,
()
=>
{
expect
(
isStoreDailyJournalType
(
"storeDaily"
)).
toBe
(
true
);
expect
(
isStoreDailyJournalType
(
"staffDaily"
)).
toBe
(
false
);
expect
(
isStoreDailyJournalType
(
"negotiation"
)).
toBe
(
false
);
});
it
(
"接口未返回模板类型时兼容,明确返回旧类型时拒绝"
,
()
=>
{
expect
(
isStoreDailyTemplateType
()).
toBe
(
true
);
expect
(
isStoreDailyTemplateType
(
STORE_DAILY_TEMPLATE_TYPE
)).
toBe
(
true
);
expect
(
isStoreDailyTemplateType
(
"2"
)).
toBe
(
true
);
expect
(
isStoreDailyTemplateType
(
1
)).
toBe
(
false
);
expect
(
isStoreDailyTemplateType
(
3
)).
toBe
(
false
);
});
});
tests/unit/views/residentManage/journalRecord/journalFormEcho.spec.js
0 → 100644
View file @
bfe1277
const
{
formatEchoValue
,
parseFormList
,
}
=
require
(
"@/views/residentManage/journalRecord/utils/journalFormEcho"
);
describe
(
"journalFormEcho V2.3.0"
,
()
=>
{
it
(
"应从 childrenValue 恢复对象类型的客户标签"
,
()
=>
{
const
[
subform
]
=
parseFormList
({
jsonContent
:
[{
key
:
"F2-107"
,
type
:
"subform"
,
origin_children
:
[
{
key
:
"F2-107-3"
,
type
:
"select"
,
label
:
"客户来源"
},
{
key
:
"F2-107-7"
,
type
:
"multipleSelect"
,
label
:
"客户标签"
},
],
childrenValue
:
[{
"F2-107"
:
{
"F2-107-3"
:
{
id
:
"delivery"
,
name
:
"交付端引流-售前"
},
"F2-107-7"
:
[{
id
:
"tag-contacted"
,
name
:
"已触客"
}],
},
}],
}],
});
const
row
=
subform
.
value
[
0
];
expect
(
formatEchoValue
(
row
.
find
(
cell
=>
cell
.
key
===
"F2-107-3"
))).
toBe
(
"交付端引流-售前"
);
expect
(
formatEchoValue
(
row
.
find
(
cell
=>
cell
.
key
===
"F2-107-7"
))).
toBe
(
"已触客"
);
});
it
(
"对象值应优先显示 name、label 或 text"
,
()
=>
{
expect
(
formatEchoValue
({
type
:
"select"
,
value
:
{
id
:
"1"
,
name
:
"张三"
}
})).
toBe
(
"张三"
);
expect
(
formatEchoValue
({
type
:
"select"
,
value
:
{
value
:
"2"
,
label
:
"李四"
}
})).
toBe
(
"李四"
);
expect
(
formatEchoValue
({
type
:
"select"
,
value
:
{
value
:
"3"
,
text
:
"王五"
}
})).
toBe
(
"王五"
);
});
it
(
"对象仅有 ID 时应回退匹配静态选项文案"
,
()
=>
{
expect
(
formatEchoValue
({
type
:
"multipleSelect"
,
value
:
[{
id
:
"tag-contacted"
}],
options
:
[{
id
:
"tag-contacted"
,
label
:
"已触客"
,
value
:
"已触客"
}],
})).
toBe
(
"已触客"
);
});
});
tests/unit/views/residentManage/journalRecord/journalFormVisibility.spec.js
View file @
bfe1277
...
...
@@ -19,7 +19,7 @@ const staffSchemaList = [
type
:
"numberInput"
,
sortNum
:
"2"
,
label
:
"延保退单"
,
rules
:
{
keys
:
[
"F1-1"
],
result
:
'val1 == "在岗"'
},
rules
:
{
keys
:
[
"F1-1"
],
result
:
"val1 == \"在岗\""
},
baseSceneCode
:
[
110201
,
110202
],
},
{
...
...
@@ -34,7 +34,7 @@ const staffSchemaList = [
sortNum
:
"5"
,
label
:
"问界"
,
brandId
:
[
3454
],
rules
:
{
keys
:
[
"F1-1"
],
result
:
'val1 == "在岗"'
},
rules
:
{
keys
:
[
"F1-1"
],
result
:
"val1 == \"在岗\""
},
children
:
[
{
key
:
"F1-5-1"
,
type
:
"numberInput"
,
sortNum
:
"1"
,
label
:
"轻改个人大定触客/进群数"
,
baseSceneCode
:
[
100101
]
},
{
key
:
"F1-5-2"
,
type
:
"numberInput"
,
sortNum
:
"2"
,
label
:
"轻改个人售后触客数"
,
baseSceneCode
:
[
100101
]
},
...
...
@@ -119,7 +119,7 @@ function buildRealOffDutyFormList() {
sortNum
:
"7"
,
label
:
"问界"
,
brandId
:
[
3454
],
rules
:
{
keys
:
[
"F1-1"
],
result
:
'val1 == "在岗"'
},
rules
:
{
keys
:
[
"F1-1"
],
result
:
"val1 == \"在岗\""
},
children
:
[
{
key
:
"F1-5-3"
,
...
...
@@ -136,7 +136,7 @@ function buildRealOffDutyFormList() {
type
:
"group"
,
sortNum
:
"48"
,
label
:
"其他品牌"
,
rules
:
{
keys
:
[
"F1-1"
],
result
:
'val1 == "在岗"'
},
rules
:
{
keys
:
[
"F1-1"
],
result
:
"val1 == \"在岗\""
},
filterBrandId
:
[
3454
,
3503
,
3458
,
3574
,
3502
,
3067
],
children
:
[
{
...
...
@@ -162,7 +162,7 @@ describe("journalFormVisibility", () => {
sceneList
:
[{
baseSceneCode
:
100101
}],
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
(
(
item
)
=>
item
.
key
);
const
keys
=
visible
.
map
(
item
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-4"
]);
});
...
...
@@ -172,7 +172,7 @@ describe("journalFormVisibility", () => {
sceneType
:
"1"
,
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
(
(
item
)
=>
item
.
key
);
const
keys
=
visible
.
map
(
item
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
...
...
@@ -185,7 +185,7 @@ describe("journalFormVisibility", () => {
sceneList
:
[{
baseSceneCode
:
100101
}],
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
(
(
item
)
=>
item
.
key
);
const
keys
=
visible
.
map
(
item
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-4"
]);
});
...
...
@@ -198,7 +198,7 @@ describe("journalFormVisibility", () => {
sceneList
:
[{
baseSceneCode
:
100101
}],
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
(
(
item
)
=>
item
.
key
);
const
keys
=
visible
.
map
(
item
=>
item
.
key
);
expect
(
keys
).
toContain
(
"F1-1"
);
expect
(
keys
).
toContain
(
"F1-5"
);
expect
(
keys
).
not
.
toContain
(
"F1-2"
);
...
...
@@ -254,7 +254,7 @@ describe("journalFormVisibility", () => {
});
const
detail
=
{
sceneType
:
"1"
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
(
(
item
)
=>
item
.
key
);
const
keys
=
visible
.
map
(
item
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
...
...
@@ -267,7 +267,7 @@ describe("journalFormVisibility", () => {
});
const
detail
=
{
sceneType
:
"1"
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
(
(
item
)
=>
item
.
key
);
const
keys
=
visible
.
map
(
item
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
...
...
@@ -312,7 +312,7 @@ describe("journalFormVisibility", () => {
schema
:
{
list
:
schemaWithoutGroupRules
},
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
(
(
item
)
=>
item
.
key
);
const
keys
=
visible
.
map
(
item
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
...
...
@@ -329,7 +329,7 @@ describe("journalFormVisibility", () => {
{
key
:
"F3-1-11"
,
type
:
"input"
,
sortNum
:
"11"
,
label
:
"订单号"
},
]],
childrenShowRules
:
{
"F3-1-11"
:
{
keys
:
[
"F3-1-10"
],
result
:
'val1 == "是"'
},
"F3-1-11"
:
{
keys
:
[
"F3-1-10"
],
result
:
"val1 == \"是\""
},
},
value
:
[[
{
key
:
"F3-1-10"
,
type
:
"radio"
,
value
:
"否"
},
...
...
@@ -343,6 +343,64 @@ describe("journalFormVisibility", () => {
};
const
visible
=
filterFormListForDisplay
([
subformField
],
detail
);
expect
(
visible
).
toHaveLength
(
1
);
expect
(
visible
[
0
].
value
[
0
].
map
((
cell
)
=>
cell
.
key
)).
toEqual
([
"F3-1-10"
]);
expect
(
visible
[
0
].
value
[
0
].
map
(
cell
=>
cell
.
key
)).
toEqual
([
"F3-1-10"
]);
});
it
(
"门店日报 V2.3.0 应使用页面场景、品牌和对象标签过滤子表单列"
,
()
=>
{
const
subformField
=
{
key
:
"F2-107"
,
type
:
"subform"
,
children
:
[[
{
key
:
"F2-107-3"
,
type
:
"select"
,
label
:
"客户来源"
},
{
key
:
"F2-107-4"
,
type
:
"date"
,
label
:
"实际交付日期"
,
baseSceneCode
:
[
100101
,
100102
,
100103
]
},
{
key
:
"F2-107-7"
,
type
:
"multipleSelect"
,
label
:
"客户标签"
,
options
:
[{
id
:
"tag-contacted"
,
label
:
"已触客"
,
value
:
"已触客"
}],
},
{
key
:
"F2-107-13"
,
type
:
"radio"
,
label
:
"是否有效引荐"
},
{
key
:
"F2-107-17"
,
type
:
"input"
,
label
:
"未触客原因"
},
{
key
:
"F2-107-18"
,
type
:
"input"
,
label
:
"未成交原因"
},
]],
childrenShowRules
:
{
"F2-107-4"
:
{
keys
:
[
"$sceneCodes"
,
"$brandIds"
,
"F2-107-3"
],
result
:
"val1 && Array.isArray(val1) && val2 && Array.isArray(val2) && (val1.includes('100101') && val2.includes('3454') && val3 == '交付端引流-售前')"
,
},
"F2-107-13"
:
{
keys
:
[
"F2-107-7"
],
result
:
"val1 && Array.isArray(val1) && val1.includes('已交付引荐')"
,
},
"F2-107-17"
:
{
keys
:
[
"F2-107-7"
],
result
:
"!Array.isArray(val1) || (val1 && !val1.includes('已触客'))"
,
},
"F2-107-18"
:
{
keys
:
[
"F2-107-7"
],
result
:
"val1 && Array.isArray(val1) && val1.includes('已触客')"
,
},
},
value
:
[[
{
key
:
"F2-107-3"
,
type
:
"select"
,
value
:
{
id
:
"delivery"
,
name
:
"交付端引流-售前"
}
},
{
key
:
"F2-107-4"
,
type
:
"date"
,
value
:
"2026-08-12"
},
{
key
:
"F2-107-7"
,
type
:
"multipleSelect"
,
value
:
[{
id
:
"tag-contacted"
}]
},
{
key
:
"F2-107-13"
,
type
:
"radio"
,
value
:
"是"
},
{
key
:
"F2-107-17"
,
type
:
"input"
,
value
:
"未联系"
},
{
key
:
"F2-107-18"
,
type
:
"input"
,
value
:
"考虑中"
},
]],
};
const
detail
=
{
schema
:
{
list
:
[
subformField
]
},
brandIds
:
[
3454
],
sceneList
:
[{
baseSceneCode
:
100101
}],
};
const
[
visible
]
=
filterFormListForDisplay
([
subformField
],
detail
);
expect
(
visible
.
value
[
0
].
map
(
cell
=>
cell
.
key
)).
toEqual
([
"F2-107-3"
,
"F2-107-4"
,
"F2-107-7"
,
"F2-107-18"
,
]);
});
});
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment