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 9920fffc
authored
Jul 20, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat 功能联调修复
1 parent
e60211c8
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
346 additions
and
55 deletions
src/api/adapters/journalRecord/mapDetailResponse.js
src/api/adapters/journalRecord/mapOverviewRow.js
src/api/journalRecord.mock.js
src/views/financeManage/exceptionOrderManage/components/abnormalFlowProcessDrawer.vue
src/views/financeManage/exceptionOrderManage/detail.vue
src/views/residentManage/journalRecord/constants.js
src/views/residentManage/journalRecord/detail.vue
src/views/residentManage/journalRecord/index.vue
src/views/residentManage/journalRecord/utils/journalFormVisibility/index.js
src/views/residentManage/journalRecord/utils/journalFormVisibility/visibilityHelpers.js
src/views/residentManage/journalRecord/utils/journalFormVisibility/visibilitySpecs.js
tests/unit/views/residentManage/journalRecord/journalFormVisibility.spec.js
src/api/adapters/journalRecord/mapDetailResponse.js
View file @
9920fff
...
@@ -26,6 +26,7 @@ export function mapDetailResponse(res = {}, fallback = {}) {
...
@@ -26,6 +26,7 @@ export function mapDetailResponse(res = {}, fallback = {}) {
subformDataList
:
res
.
subformDataList
,
subformDataList
:
res
.
subformDataList
,
reportTemplateId
:
res
.
reportTemplateId
,
reportTemplateId
:
res
.
reportTemplateId
,
baseSceneCode
:
res
.
baseSceneCode
,
baseSceneCode
:
res
.
baseSceneCode
,
sceneType
:
res
.
sceneType
??
fallback
.
sceneType
,
schema
:
res
.
schema
,
schema
:
res
.
schema
,
brandIds
:
res
.
brandIds
??
fallback
.
brandIds
??
[],
brandIds
:
res
.
brandIds
??
fallback
.
brandIds
??
[],
sceneList
:
res
.
sceneList
??
fallback
.
sceneList
??
[],
sceneList
:
res
.
sceneList
??
fallback
.
sceneList
??
[],
...
...
src/api/adapters/journalRecord/mapOverviewRow.js
View file @
9920fff
...
@@ -10,7 +10,7 @@ export function mapOverviewRow(row = {}) {
...
@@ -10,7 +10,7 @@ export function mapOverviewRow(row = {}) {
return
{
return
{
id
:
row
.
id
??
row
.
dailyReportRecordId
,
id
:
row
.
id
??
row
.
dailyReportRecordId
,
staffName
:
row
.
staffName
,
staffName
:
row
.
staffName
??
row
.
staffname
??
""
,
staffUuid
:
row
.
staffUuid
,
staffUuid
:
row
.
staffUuid
,
merchantId
:
row
.
merchantId
,
merchantId
:
row
.
merchantId
,
merchantName
:
row
.
merchantName
,
merchantName
:
row
.
merchantName
,
...
@@ -20,7 +20,6 @@ export function mapOverviewRow(row = {}) {
...
@@ -20,7 +20,6 @@ export function mapOverviewRow(row = {}) {
staffCount
:
row
.
staffCount
,
staffCount
:
row
.
staffCount
,
lastSaveTime
:
createdDate
,
lastSaveTime
:
createdDate
,
submitTime
:
reportStatus
===
1
?
(
row
.
submitTime
??
createdDate
)
:
(
row
.
submitTime
||
""
),
submitTime
:
reportStatus
===
1
?
(
row
.
submitTime
??
createdDate
)
:
(
row
.
submitTime
||
""
),
submitUserName
:
row
.
submitUserName
??
row
.
submitStaffName
??
""
,
reportDate
:
row
.
reportDate
,
reportDate
:
row
.
reportDate
,
templateType
:
row
.
templateType
,
templateType
:
row
.
templateType
,
reportStatus
,
reportStatus
,
...
...
src/api/journalRecord.mock.js
View file @
9920fff
...
@@ -78,6 +78,7 @@ function buildStoreDailyList(params) {
...
@@ -78,6 +78,7 @@ function buildStoreDailyList(params) {
merchantName
:
store
.
merchantName
,
merchantName
:
store
.
merchantName
,
sceneType
:
String
(
store
.
sceneType
),
sceneType
:
String
(
store
.
sceneType
),
staffCount
:
3
,
staffCount
:
3
,
staffName
:
index
%
3
===
0
?
""
:
STAFF_LIST
[
index
%
STAFF_LIST
.
length
].
staffName
,
createdDate
:
"2026-06-12 14:41:00"
,
createdDate
:
"2026-06-12 14:41:00"
,
reportStatus
:
index
%
3
===
0
?
0
:
1
,
reportStatus
:
index
%
3
===
0
?
0
:
1
,
reportDate
:
params
.
reportDate
,
reportDate
:
params
.
reportDate
,
...
...
src/views/financeManage/exceptionOrderManage/components/abnormalFlowProcessDrawer.vue
View file @
9920fff
...
@@ -91,9 +91,9 @@
...
@@ -91,9 +91,9 @@
</div>
</div>
<div
class=
"drawer-footer"
>
<div
class=
"drawer-footer"
>
<el-button
@
click=
"handleClose"
>
<el-button
@
click=
"handleClose"
>
取消
{{ readonly ? "关闭" : "取消" }}
</el-button>
</el-button>
<el-button
v-if=
"drawerMode === 'approve'"
<el-button
v-if=
"
!readonly &&
drawerMode === 'approve'"
type=
"primary"
type=
"primary"
:loading=
"submitting"
:loading=
"submitting"
@
click=
"handleSubmit"
>
@
click=
"handleSubmit"
>
...
@@ -147,6 +147,10 @@ export default {
...
@@ -147,6 +147,10 @@ export default {
type
:
Object
,
type
:
Object
,
default
:
null
,
default
:
null
,
},
},
readonly
:
{
type
:
Boolean
,
default
:
false
,
},
},
},
data
()
{
data
()
{
const
validateRemark
=
(
rule
,
value
,
callback
)
=>
{
const
validateRemark
=
(
rule
,
value
,
callback
)
=>
{
...
@@ -274,6 +278,9 @@ export default {
...
@@ -274,6 +278,9 @@ export default {
},
},
},
},
drawerMode
()
{
drawerMode
()
{
if
(
this
.
readonly
)
{
return
"view"
;
}
return
getDrawerMode
(
this
.
detailInfo
);
return
getDrawerMode
(
this
.
detailInfo
);
},
},
showSecondRoundSection
()
{
showSecondRoundSection
()
{
...
...
src/views/financeManage/exceptionOrderManage/detail.vue
View file @
9920fff
...
@@ -97,6 +97,13 @@
...
@@ -97,6 +97,13 @@
</
template
>
</
template
>
<
template
slot=
"auth-button"
slot-scope=
"scope"
>
<
template
slot=
"auth-button"
slot-scope=
"scope"
>
<el-button
<el-button
v-if=
"canViewProcessRow(scope.scope)"
type=
"text"
@
click=
"handleViewProcess(scope.scope)"
>
查看
</el-button>
<el-button
v-if=
"canProcessRow(scope.scope)"
v-if=
"canProcessRow(scope.scope)"
type=
"text"
type=
"text"
@
click=
"handleProcess(scope.scope)"
@
click=
"handleProcess(scope.scope)"
...
@@ -231,6 +238,7 @@
...
@@ -231,6 +238,7 @@
<abnormal-flow-process-drawer
<abnormal-flow-process-drawer
:visible
.
sync=
"processDrawerVisible"
:visible
.
sync=
"processDrawerVisible"
:row-data=
"currentProcessRow"
:row-data=
"currentProcessRow"
:readonly=
"processDrawerReadonly"
@
success=
"handleProcessSuccess"
@
success=
"handleProcessSuccess"
/>
/>
<
template
slot=
"footer"
>
<
template
slot=
"footer"
>
...
@@ -278,6 +286,7 @@ export default {
...
@@ -278,6 +286,7 @@ export default {
lockSwitchLoading
:
false
,
lockSwitchLoading
:
false
,
previousLockFlag
:
"N"
,
previousLockFlag
:
"N"
,
processDrawerVisible
:
false
,
processDrawerVisible
:
false
,
processDrawerReadonly
:
false
,
currentProcessRow
:
null
,
currentProcessRow
:
null
,
// Confirm Dialog Data
// Confirm Dialog Data
...
@@ -432,7 +441,7 @@ export default {
...
@@ -432,7 +441,7 @@ export default {
transactionTableParams
:
{
transactionTableParams
:
{
listName
:
"list"
,
listName
:
"list"
,
tableOption
:
{
tableOption
:
{
width
:
"1
0
0px"
,
width
:
"1
4
0px"
,
fixed
:
"right"
fixed
:
"right"
},
},
tableColumns
:
[
tableColumns
:
[
...
@@ -666,6 +675,12 @@ export default {
...
@@ -666,6 +675,12 @@ export default {
}
}
return
Number
(
row
.
declarationApprovalStatus
)
===
APPROVAL_STATUS
.
WAIT_BACKEND
return
Number
(
row
.
declarationApprovalStatus
)
===
APPROVAL_STATUS
.
WAIT_BACKEND
},
},
canViewProcessRow
(
row
)
{
if
(
!
row
||
!
row
.
declarationId
)
{
return
false
}
return
getApprovalStatusMeta
(
row
.
declarationApprovalStatus
).
label
!==
"-"
},
async
fetchShopLockConfig
()
{
async
fetchShopLockConfig
()
{
const
{
merchantId
,
merchantName
,
storeType
}
=
this
.
routerInfo
const
{
merchantId
,
merchantName
,
storeType
}
=
this
.
routerInfo
if
(
!
merchantId
||
storeType
===
undefined
||
storeType
===
""
)
{
if
(
!
merchantId
||
storeType
===
undefined
||
storeType
===
""
)
{
...
@@ -713,11 +728,17 @@ export default {
...
@@ -713,11 +728,17 @@ export default {
this
.
abnormalFlowLockFlag
=
prev
this
.
abnormalFlowLockFlag
=
prev
}
}
},
},
handleViewProcess
(
row
)
{
this
.
processDrawerReadonly
=
true
this
.
currentProcessRow
=
row
this
.
processDrawerVisible
=
true
},
handleProcess
(
row
)
{
handleProcess
(
row
)
{
if
(
!
this
.
canProcessRow
(
row
))
{
if
(
!
this
.
canProcessRow
(
row
))
{
this
.
$message
.
warning
(
"仅待后台审批的报备可处理"
)
this
.
$message
.
warning
(
"仅待后台审批的报备可处理"
)
return
return
}
}
this
.
processDrawerReadonly
=
false
this
.
currentProcessRow
=
row
this
.
currentProcessRow
=
row
this
.
processDrawerVisible
=
true
this
.
processDrawerVisible
=
true
},
},
...
...
src/views/residentManage/journalRecord/constants.js
View file @
9920fff
...
@@ -99,7 +99,7 @@ export const TABLE_COLUMNS_MAP = {
...
@@ -99,7 +99,7 @@ export const TABLE_COLUMNS_MAP = {
},
},
createDateTimeColumn
(
"最近保存时间"
,
"lastSaveTime"
),
createDateTimeColumn
(
"最近保存时间"
,
"lastSaveTime"
),
createDateTimeColumn
(
"提交时间"
,
"submitTime"
),
createDateTimeColumn
(
"提交时间"
,
"submitTime"
),
createEmptyTextColumn
(
"提交人"
,
"s
ubmitUser
Name"
,
{
createEmptyTextColumn
(
"提交人"
,
"s
taff
Name"
,
{
minWidth
:
"100px"
,
minWidth
:
"100px"
,
width
:
"120px"
,
width
:
"120px"
,
showOverFlow
:
true
,
showOverFlow
:
true
,
...
...
src/views/residentManage/journalRecord/detail.vue
View file @
9920fff
...
@@ -50,7 +50,14 @@ export default {
...
@@ -50,7 +50,14 @@ export default {
},
},
methods
:
{
methods
:
{
async
fetchDetail
()
{
async
fetchDetail
()
{
const
{
id
,
journalType
,
reportDate
,
merchantId
,
staffUuid
}
=
this
.
$route
.
query
;
const
{
id
,
journalType
,
reportDate
,
merchantId
,
staffUuid
,
sceneType
,
}
=
this
.
$route
.
query
;
if
(
!
id
)
{
if
(
!
id
)
{
return
;
return
;
}
}
...
@@ -63,6 +70,7 @@ export default {
...
@@ -63,6 +70,7 @@ export default {
reportDate
,
reportDate
,
merchantId
,
merchantId
,
staffUuid
,
staffUuid
,
sceneType
,
});
});
this
.
detail
=
{
this
.
detail
=
{
...
res
,
...
res
,
...
...
src/views/residentManage/journalRecord/index.vue
View file @
9920fff
...
@@ -340,6 +340,7 @@ export default {
...
@@ -340,6 +340,7 @@ export default {
reportDate
:
this
.
reportDate
,
reportDate
:
this
.
reportDate
,
merchantId
:
row
.
merchantId
,
merchantId
:
row
.
merchantId
,
staffUuid
:
row
.
staffUuid
,
staffUuid
:
row
.
staffUuid
,
sceneType
:
row
.
sceneType
,
},
},
});
});
}
}
...
...
src/views/residentManage/journalRecord/utils/journalFormVisibility/index.js
View file @
9920fff
...
@@ -7,10 +7,14 @@ import {
...
@@ -7,10 +7,14 @@ import {
import
{
filterVisibleRowFields
}
from
"./groupVisibility"
;
import
{
filterVisibleRowFields
}
from
"./groupVisibility"
;
import
{
isAttendanceOnDuty
}
from
"./radioValue"
;
import
{
isAttendanceOnDuty
}
from
"./radioValue"
;
import
{
import
{
flattenFields
,
findSchemaFieldInContext
,
isStaffBrandGroupOnOffDuty
,
resolveDetailSceneList
,
resolveFieldShowRules
,
resolveSchemaList
,
schemaHasAttendanceField
,
schemaHasAttendanceField
,
}
from
"./visibilityHelpers"
;
}
from
"./visibilityHelpers"
;
import
{
isFieldVisible
,
isFieldVisible
BySpecs
}
from
"./visibilitySpecs"
;
import
{
isFieldVisibleBySpecs
}
from
"./visibilitySpecs"
;
function
sortBySortNum
(
list
=
[])
{
function
sortBySortNum
(
list
=
[])
{
return
[
...
list
].
sort
((
a
,
b
)
=>
return
[
...
list
].
sort
((
a
,
b
)
=>
...
@@ -25,13 +29,9 @@ function getEchoKeysFromFormList(formList = []) {
...
@@ -25,13 +29,9 @@ function getEchoKeysFromFormList(formList = []) {
return
{
echoSubformKeys
,
echoTopLevelKeys
};
return
{
echoSubformKeys
,
echoTopLevelKeys
};
}
}
export
function
buildDetailPageContext
(
detail
=
{},
formList
=
[])
{
function
buildDetailPageContext
(
detail
=
{},
formList
=
[])
{
const
{
echoSubformKeys
,
echoTopLevelKeys
}
=
getEchoKeysFromFormList
(
formList
);
const
{
echoSubformKeys
,
echoTopLevelKeys
}
=
getEchoKeysFromFormList
(
formList
);
const
sceneList
=
Array
.
isArray
(
detail
.
sceneList
)
&&
detail
.
sceneList
.
length
const
sceneList
=
resolveDetailSceneList
(
detail
);
?
detail
.
sceneList
:
(
detail
.
baseSceneCode
!=
null
&&
detail
.
baseSceneCode
!==
""
?
[{
baseSceneCode
:
detail
.
baseSceneCode
}]
:
[]);
return
{
return
{
hasDetailEcho
:
formList
.
length
>
0
,
hasDetailEcho
:
formList
.
length
>
0
,
...
@@ -40,11 +40,11 @@ export function buildDetailPageContext(detail = {}, formList = []) {
...
@@ -40,11 +40,11 @@ export function buildDetailPageContext(detail = {}, formList = []) {
sceneList
,
sceneList
,
baseSceneCode
:
detail
.
baseSceneCode
,
baseSceneCode
:
detail
.
baseSceneCode
,
brandIds
:
Array
.
isArray
(
detail
.
brandIds
)
?
detail
.
brandIds
:
[],
brandIds
:
Array
.
isArray
(
detail
.
brandIds
)
?
detail
.
brandIds
:
[],
schemaList
:
detail
.
schema
?.
list
||
formList
,
schemaList
:
resolveSchemaList
(
detail
,
formList
)
,
};
};
}
}
export
function
buildValuesMap
(
formList
=
[])
{
function
buildValuesMap
(
formList
=
[])
{
const
values
=
{};
const
values
=
{};
formList
.
forEach
((
field
)
=>
{
formList
.
forEach
((
field
)
=>
{
if
(
if
(
...
@@ -59,74 +59,78 @@ export function buildValuesMap(formList = []) {
...
@@ -59,74 +59,78 @@ export function buildValuesMap(formList = []) {
return
values
;
return
values
;
}
}
function
findSchemaField
(
schemaList
=
[],
key
=
""
)
{
function
mergeFieldMeta
(
field
=
{},
schemaList
=
[],
formList
=
[])
{
return
flattenFields
(
schemaList
).
find
((
field
)
=>
field
.
key
===
key
);
const
schemaField
=
findSchemaFieldInContext
(
schemaList
,
formList
,
field
.
key
);
}
function
mergeFieldMeta
(
field
=
{},
schemaList
=
[])
{
const
schemaField
=
findSchemaField
(
schemaList
,
field
.
key
);
if
(
!
schemaField
)
{
if
(
!
schemaField
)
{
return
field
;
return
field
;
}
}
return
{
return
{
...
schemaField
,
...
schemaField
,
...
field
,
...
field
,
rules
:
field
.
rules
||
schemaField
.
rules
,
rules
:
resolveFieldShowRules
(
field
,
schemaField
)
,
children
:
field
.
children
??
schemaField
.
children
,
children
:
field
.
children
??
schemaField
.
children
,
childrenShowRules
:
field
.
childrenShowRules
||
schemaField
.
childrenShowRules
,
childrenShowRules
:
field
.
childrenShowRules
||
schemaField
.
childrenShowRules
,
options
:
field
.
options
||
schemaField
.
options
,
options
:
field
.
options
||
schemaField
.
options
,
};
};
}
}
function
buildVisibilityOptions
(
schemaList
=
[],
values
=
{},
ctx
=
{})
{
function
buildVisibilityOptions
(
schemaList
=
[],
formList
=
[],
values
=
{},
ctx
=
{})
{
const
hasAttendanceField
=
schemaHasAttendanceField
(
schemaList
)
||
schemaHasAttendanceField
(
formList
);
const
attendanceSourceList
=
schemaHasAttendanceField
(
schemaList
)
?
schemaList
:
formList
;
return
{
return
{
schemaList
,
schemaList
,
hasAttendanceField
:
schemaHasAttendanceField
(
schemaList
)
,
hasAttendanceField
,
attendanceOnDuty
:
isAttendanceOnDuty
(
schema
List
,
values
),
attendanceOnDuty
:
isAttendanceOnDuty
(
attendanceSource
List
,
values
),
echoSubformKeys
:
ctx
.
echoSubformKeys
instanceof
Set
echoSubformKeys
:
ctx
.
echoSubformKeys
instanceof
Set
?
ctx
.
echoSubformKeys
?
ctx
.
echoSubformKeys
:
new
Set
(
ctx
.
echoSubformKeys
||
[]),
:
new
Set
(
ctx
.
echoSubformKeys
||
[]),
};
};
}
}
export
function
getVisibleSubformChildren
(
group
,
ctx
,
values
,
schema
List
=
[])
{
function
getVisibleSubformChildren
(
group
,
ctx
,
values
,
schemaList
=
[],
form
List
=
[])
{
if
(
!
group
||
!
isSubform
(
group
))
{
if
(
!
group
||
!
isSubform
(
group
))
{
return
[];
return
[];
}
}
const
visibilityOptions
=
{
const
visibilityOptions
=
{
...
buildVisibilityOptions
(
schemaList
,
values
,
ctx
),
...
buildVisibilityOptions
(
schemaList
,
formList
,
values
,
ctx
),
echoParentKey
:
group
?.
key
,
echoParentKey
:
group
?.
key
,
};
};
return
getSubformRowTemplate
(
group
)
return
getSubformRowTemplate
(
group
)
.
map
((
child
)
=>
mergeFieldMeta
(
child
,
schemaList
))
.
map
((
child
)
=>
mergeFieldMeta
(
child
,
schemaList
,
formList
))
.
filter
((
child
)
=>
isFieldVisible
(
child
,
ctx
,
values
,
visibilityOptions
))
.
filter
((
child
)
=>
isFieldVisible
BySpecs
(
child
,
ctx
,
values
,
visibilityOptions
))
.
sort
((
a
,
b
)
=>
Number
(
a
.
sortNum
)
-
Number
(
b
.
sortNum
));
.
sort
((
a
,
b
)
=>
Number
(
a
.
sortNum
)
-
Number
(
b
.
sortNum
));
}
}
export
function
getVisibleGroupChildren
(
group
,
ctx
,
values
,
schema
List
=
[])
{
function
getVisibleGroupChildren
(
group
,
ctx
,
values
,
schemaList
=
[],
form
List
=
[])
{
if
(
!
group
||
!
isStaticGroup
(
group
))
{
if
(
!
group
||
!
isStaticGroup
(
group
))
{
return
[];
return
[];
}
}
const
visibilityOptions
=
{
const
visibilityOptions
=
{
...
buildVisibilityOptions
(
schemaList
,
values
,
ctx
),
...
buildVisibilityOptions
(
schemaList
,
formList
,
values
,
ctx
),
echoParentKey
:
group
?.
key
,
echoParentKey
:
group
?.
key
,
};
};
return
getStaticGroupChildren
(
group
)
return
getStaticGroupChildren
(
group
)
.
map
((
child
)
=>
mergeFieldMeta
(
child
,
schemaList
))
.
map
((
child
)
=>
mergeFieldMeta
(
child
,
schemaList
,
formList
))
.
filter
((
child
)
=>
isFieldVisible
(
child
,
ctx
,
values
,
visibilityOptions
))
.
filter
((
child
)
=>
isFieldVisible
BySpecs
(
child
,
ctx
,
values
,
visibilityOptions
))
.
sort
((
a
,
b
)
=>
Number
(
a
.
sortNum
)
-
Number
(
b
.
sortNum
));
.
sort
((
a
,
b
)
=>
Number
(
a
.
sortNum
)
-
Number
(
b
.
sortNum
));
}
}
function
filterFieldNode
(
field
,
schemaList
,
ctx
,
values
,
options
)
{
function
filterFieldNode
(
field
,
schemaList
,
formList
,
ctx
,
values
,
options
)
{
const
merged
=
mergeFieldMeta
(
field
,
schemaList
);
const
merged
=
mergeFieldMeta
(
field
,
schemaList
,
formList
);
const
visibilityOptions
=
{
...
options
};
const
visibilityOptions
=
{
...
options
};
if
(
isStaffBrandGroupOnOffDuty
(
merged
,
visibilityOptions
))
{
return
null
;
}
if
(
!
isFieldVisibleBySpecs
(
merged
,
ctx
,
values
,
visibilityOptions
))
{
if
(
!
isFieldVisibleBySpecs
(
merged
,
ctx
,
values
,
visibilityOptions
))
{
return
null
;
return
null
;
}
}
if
(
isStaticGroup
(
merged
))
{
if
(
isStaticGroup
(
merged
))
{
const
visibleChildren
=
getVisibleGroupChildren
(
merged
,
ctx
,
values
,
schemaList
);
const
visibleChildren
=
getVisibleGroupChildren
(
merged
,
ctx
,
values
,
schemaList
,
formList
);
if
(
!
visibleChildren
.
length
)
{
if
(
!
visibleChildren
.
length
)
{
return
null
;
return
null
;
}
}
...
@@ -144,7 +148,7 @@ function filterFieldNode(field, schemaList, ctx, values, options) {
...
@@ -144,7 +148,7 @@ function filterFieldNode(field, schemaList, ctx, values, options) {
}
}
if
(
isSubform
(
merged
))
{
if
(
isSubform
(
merged
))
{
const
visibleTemplate
=
getVisibleSubformChildren
(
merged
,
ctx
,
values
,
schemaList
);
const
visibleTemplate
=
getVisibleSubformChildren
(
merged
,
ctx
,
values
,
schemaList
,
formList
);
if
(
!
visibleTemplate
.
length
)
{
if
(
!
visibleTemplate
.
length
)
{
return
null
;
return
null
;
}
}
...
@@ -156,7 +160,7 @@ function filterFieldNode(field, schemaList, ctx, values, options) {
...
@@ -156,7 +160,7 @@ function filterFieldNode(field, schemaList, ctx, values, options) {
...(
templateMap
.
get
(
col
.
key
)
||
{}),
...(
templateMap
.
get
(
col
.
key
)
||
{}),
}));
}));
const
rowFieldsList
=
Array
.
isArray
(
merged
.
value
)
?
merged
.
value
:
[];
const
rowFieldsList
=
Array
.
isArray
(
merged
.
value
)
?
merged
.
value
:
[];
const
groupDef
=
mergeFieldMeta
(
merged
,
schemaList
);
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
const
filteredRows
=
rowFieldsList
.
map
((
rowCells
)
=>
{
.
map
((
rowCells
)
=>
{
...
@@ -186,19 +190,16 @@ export function filterFormListForDisplay(formList = [], detail = {}) {
...
@@ -186,19 +190,16 @@ export function filterFormListForDisplay(formList = [], detail = {}) {
if
(
!
formList
.
length
)
{
if
(
!
formList
.
length
)
{
return
[];
return
[];
}
}
const
schemaList
=
detail
.
schema
?.
list
||
formList
;
const
schemaList
=
resolveSchemaList
(
detail
,
formList
)
;
const
values
=
buildValuesMap
(
formList
);
const
values
=
buildValuesMap
(
formList
);
const
ctx
=
buildDetailPageContext
(
detail
,
formList
);
const
ctx
=
buildDetailPageContext
(
detail
,
formList
);
const
options
=
buildVisibilityOptions
(
schemaList
,
values
,
ctx
);
const
options
=
buildVisibilityOptions
(
schemaList
,
formList
,
values
,
ctx
);
return
sortBySortNum
(
return
sortBySortNum
(
formList
formList
.
map
((
field
)
=>
filterFieldNode
(
field
,
schemaList
,
ctx
,
values
,
options
))
.
map
((
field
)
=>
filterFieldNode
(
field
,
schemaList
,
formList
,
ctx
,
values
,
options
))
.
filter
(
Boolean
),
.
filter
(
Boolean
),
);
);
}
}
export
{
export
{
isFieldVisibleBySpecs
};
isFieldVisible
,
isFieldVisibleBySpecs
,
};
src/views/residentManage/journalRecord/utils/journalFormVisibility/visibilityHelpers.js
View file @
9920fff
...
@@ -7,6 +7,8 @@ import {
...
@@ -7,6 +7,8 @@ import {
const
DIVIDER_QY_SCENE_CODES
=
[
110101
,
110102
];
const
DIVIDER_QY_SCENE_CODES
=
[
110101
,
110102
];
const
DIVIDER_YB_SCENE_CODES
=
[
110201
,
110202
];
const
DIVIDER_YB_SCENE_CODES
=
[
110201
,
110202
];
const
SCENE_TYPE_LIGHT_REFORM_CODES
=
[
100101
,
100102
,
100103
];
const
SCENE_TYPE_RIGHTS_CODES
=
[
110101
,
110102
,
110201
,
110202
];
export
const
ATTENDANCE_KEY
=
"F1-1"
;
export
const
ATTENDANCE_KEY
=
"F1-1"
;
...
@@ -40,6 +42,54 @@ export function schemaHasAttendanceField(list = []) {
...
@@ -40,6 +42,54 @@ export function schemaHasAttendanceField(list = []) {
return
flattenFields
(
list
).
some
((
field
)
=>
field
.
key
===
ATTENDANCE_KEY
);
return
flattenFields
(
list
).
some
((
field
)
=>
field
.
key
===
ATTENDANCE_KEY
);
}
}
/** 字段是否受 F1-1 出勤 rules.result 联动 */
export
function
isAttendanceGatedField
(
field
=
{})
{
const
rules
=
field
.
rules
||
{};
const
keys
=
rules
.
keys
||
[];
return
keys
.
includes
(
ATTENDANCE_KEY
)
&&
!!
rules
.
result
;
}
/** 优先取带 keys/result 的出勤联动 rules,避免被 min/integer 等校验 rules 覆盖 */
export
function
resolveFieldShowRules
(
field
=
{},
schemaField
=
{})
{
const
candidates
=
[
field
?.
rules
,
schemaField
?.
rules
];
const
withGate
=
candidates
.
find
((
rules
)
=>
rules
?.
keys
?.
length
&&
rules
?.
result
);
if
(
withGate
)
{
return
withGate
;
}
return
field
?.
rules
||
schemaField
?.
rules
||
{};
}
export
function
findSchemaFieldInContext
(
schemaList
=
[],
formList
=
[],
key
=
""
)
{
return
flattenFields
(
schemaList
).
find
((
field
)
=>
field
.
key
===
key
)
||
flattenFields
(
formList
).
find
((
field
)
=>
field
.
key
===
key
);
}
/** 驻店日报调休时隐藏 brand group(对 merge 后的字段判断) */
export
function
isStaffBrandGroupOnOffDuty
(
field
=
{},
options
=
{})
{
if
(
!
options
.
hasAttendanceField
||
options
.
attendanceOnDuty
)
{
return
false
;
}
if
(
field
.
type
!==
"group"
)
{
return
false
;
}
if
(
isAttendanceGatedField
(
field
))
{
return
true
;
}
if
(
field
.
brandId
?.
length
||
field
.
filterBrandId
?.
length
)
{
return
true
;
}
return
false
;
}
/** 详情 schema 回退:空 schema.list 时使用 jsonContent formList */
export
function
resolveSchemaList
(
detail
=
{},
formList
=
[])
{
const
fromSchema
=
detail
.
schema
?.
list
;
if
(
Array
.
isArray
(
fromSchema
)
&&
fromSchema
.
length
)
{
return
fromSchema
;
}
return
formList
;
}
export
function
getMerchantSceneCodes
(
sceneList
=
[])
{
export
function
getMerchantSceneCodes
(
sceneList
=
[])
{
return
normalizeSceneCodeList
((
sceneList
||
[]).
map
((
item
)
=>
item
?.
baseSceneCode
));
return
normalizeSceneCodeList
((
sceneList
||
[]).
map
((
item
)
=>
item
?.
baseSceneCode
));
}
}
...
@@ -91,3 +141,27 @@ export function shouldHideByFilterBrandId(field = {}, brandIds = []) {
...
@@ -91,3 +141,27 @@ export function shouldHideByFilterBrandId(field = {}, brandIds = []) {
const
hasOtherBrand
=
brandIds
.
some
((
id
)
=>
!
field
.
filterBrandId
.
includes
(
id
));
const
hasOtherBrand
=
brandIds
.
some
((
id
)
=>
!
field
.
filterBrandId
.
includes
(
id
));
return
!
hasOtherBrand
;
return
!
hasOtherBrand
;
}
}
/** sceneType(0 权益 / 1 轻改)→ sceneList,与列表 bizTypeName 同源 */
export
function
inferSceneListFromSceneType
(
sceneType
)
{
if
(
sceneType
==
null
||
sceneType
===
""
)
{
return
[];
}
const
codes
=
String
(
sceneType
)
===
"1"
?
SCENE_TYPE_LIGHT_REFORM_CODES
:
String
(
sceneType
)
===
"0"
?
SCENE_TYPE_RIGHTS_CODES
:
[];
return
codes
.
map
((
baseSceneCode
)
=>
({
baseSceneCode
}));
}
/** 详情 sceneList 解析:接口 sceneList → baseSceneCode → sceneType */
export
function
resolveDetailSceneList
(
detail
=
{})
{
if
(
Array
.
isArray
(
detail
.
sceneList
)
&&
detail
.
sceneList
.
length
)
{
return
detail
.
sceneList
;
}
if
(
detail
.
baseSceneCode
!=
null
&&
detail
.
baseSceneCode
!==
""
)
{
return
[{
baseSceneCode
:
detail
.
baseSceneCode
}];
}
return
inferSceneListFromSceneType
(
detail
.
sceneType
);
}
src/views/residentManage/journalRecord/utils/journalFormVisibility/visibilitySpecs.js
View file @
9920fff
...
@@ -2,8 +2,10 @@ import { evaluateShowRule } from "./groupShowRuleEval";
...
@@ -2,8 +2,10 @@ import { evaluateShowRule } from "./groupShowRuleEval";
import
{
isStaticGroup
,
isSubform
}
from
"./fieldTypes"
;
import
{
isStaticGroup
,
isSubform
}
from
"./fieldTypes"
;
import
{
resolveRadioOptionValue
}
from
"./radioValue"
;
import
{
resolveRadioOptionValue
}
from
"./radioValue"
;
import
{
import
{
ATTENDANCE_KEY
,
flattenFields
,
flattenFields
,
hasIntersection
,
hasIntersection
,
isAttendanceGatedField
,
isDividerVisible
,
isDividerVisible
,
matchesBaseSceneCode
,
matchesBaseSceneCode
,
shouldHideByFilterBrandId
,
shouldHideByFilterBrandId
,
...
@@ -58,6 +60,13 @@ export function detailEchoSpec(field, ctx, _values, options = {}) {
...
@@ -58,6 +60,13 @@ export function detailEchoSpec(field, ctx, _values, options = {}) {
if
(
field
.
type
===
"divider"
)
{
if
(
field
.
type
===
"divider"
)
{
return
isDividerVisible
(
field
,
ctx
);
return
isDividerVisible
(
field
,
ctx
);
}
}
if
(
options
.
hasAttendanceField
&&
!
options
.
attendanceOnDuty
&&
isAttendanceGatedField
(
field
)
)
{
return
null
;
}
return
true
;
return
true
;
}
}
if
(
options
.
hasAttendanceField
&&
options
.
attendanceOnDuty
)
{
if
(
options
.
hasAttendanceField
&&
options
.
attendanceOnDuty
)
{
...
@@ -134,7 +143,3 @@ export function isFieldVisibleBySpecs(field, ctx, values, options = {}) {
...
@@ -134,7 +143,3 @@ export function isFieldVisibleBySpecs(field, ctx, values, options = {}) {
}
}
return
true
;
return
true
;
}
}
export
function
isFieldVisible
(
field
,
ctx
,
values
,
options
=
{})
{
return
isFieldVisibleBySpecs
(
field
,
ctx
,
values
,
options
);
}
tests/unit/views/residentManage/journalRecord/journalFormVisibility.spec.js
View file @
9920fff
...
@@ -77,8 +77,83 @@ function buildOnDutyFormList() {
...
@@ -77,8 +77,83 @@ function buildOnDutyFormList() {
];
];
}
}
function
buildRealOffDutyFormList
()
{
return
[
{
key
:
"F1-1"
,
type
:
"radio"
,
sortNum
:
"1"
,
label
:
"今日出勤"
,
options
:
[
{
label
:
"在岗"
,
value
:
"在岗"
},
{
label
:
"调休"
,
value
:
"调休"
},
],
value
:
"调休"
,
},
{
key
:
"F1-12"
,
type
:
"numberInput"
,
sortNum
:
"2"
,
label
:
"轻改问界鸿蒙个人大定触客/进群数"
,
baseSceneCode
:
[
100101
,
100102
,
100103
],
value
:
10
,
},
{
key
:
"F1-13"
,
type
:
"numberInput"
,
sortNum
:
"3"
,
label
:
"轻改问界鸿蒙个人售后触客数"
,
baseSceneCode
:
[
100101
,
100102
,
100103
],
value
:
20
,
},
{
key
:
"F1-4"
,
type
:
"textarea"
,
sortNum
:
"6"
,
label
:
"备注"
,
value
:
""
,
},
{
key
:
"F1-5"
,
type
:
"group"
,
sortNum
:
"7"
,
label
:
"问界"
,
brandId
:
[
3454
],
rules
:
{
keys
:
[
"F1-1"
],
result
:
'val1 == "在岗"'
},
children
:
[
{
key
:
"F1-5-3"
,
type
:
"numberInput"
,
sortNum
:
"10"
,
label
:
"轻改个人交付引荐数"
,
baseSceneCode
:
[
100101
,
100102
,
100103
],
value
:
20
,
},
],
},
{
key
:
"F1-11"
,
type
:
"group"
,
sortNum
:
"48"
,
label
:
"其他品牌"
,
rules
:
{
keys
:
[
"F1-1"
],
result
:
'val1 == "在岗"'
},
filterBrandId
:
[
3454
,
3503
,
3458
,
3574
,
3502
,
3067
],
children
:
[
{
key
:
"F1-11-1"
,
type
:
"numberInput"
,
sortNum
:
"49"
,
label
:
"轻改个人售前有效触客数"
,
baseSceneCode
:
[
100101
,
100102
,
100103
],
value
:
20
,
},
],
},
];
}
describe
(
"journalFormVisibility"
,
()
=>
{
describe
(
"journalFormVisibility"
,
()
=>
{
it
(
"调休且 jsonContent 含品牌 group 时
应展示 F1-5 及轻改子字段
"
,
()
=>
{
it
(
"调休且 jsonContent 含品牌 group 时
不应展示出勤联动 group
"
,
()
=>
{
const
formList
=
buildOffDutyFormListWithBrandGroup
();
const
formList
=
buildOffDutyFormListWithBrandGroup
();
const
detail
=
{
const
detail
=
{
schema
:
{
list
:
staffSchemaList
},
schema
:
{
list
:
staffSchemaList
},
...
@@ -88,9 +163,17 @@ describe("journalFormVisibility", () => {
...
@@ -88,9 +163,17 @@ describe("journalFormVisibility", () => {
};
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
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"
,
"F1-5"
]);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-4"
]);
const
f15
=
visible
.
find
((
item
)
=>
item
.
key
===
"F1-5"
);
});
expect
(
f15
.
children
.
map
((
child
)
=>
child
.
key
)).
toEqual
([
"F1-5-1"
,
"F1-5-2"
]);
it
(
"调休真实 jsonContent 应展示 F1-12/F1-13 但隐藏 F1-5/F1-11 group"
,
()
=>
{
const
formList
=
buildRealOffDutyFormList
();
const
detail
=
{
sceneType
:
"1"
,
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
((
item
)
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
});
it
(
"调休且 jsonContent 无品牌 group 时应仅保留 F1-1 与 F1-4"
,
()
=>
{
it
(
"调休且 jsonContent 无品牌 group 时应仅保留 F1-1 与 F1-4"
,
()
=>
{
...
@@ -143,6 +226,96 @@ describe("journalFormVisibility", () => {
...
@@ -143,6 +226,96 @@ describe("journalFormVisibility", () => {
expect
(
isFieldVisibleBySpecs
(
field
,
mismatchCtx
,
{},
{
schemaList
:
[
field
]
})).
toBe
(
false
);
expect
(
isFieldVisibleBySpecs
(
field
,
mismatchCtx
,
{},
{
schemaList
:
[
field
]
})).
toBe
(
false
);
});
});
it
(
"sceneType 权益时不应展示轻改顶层字段"
,
()
=>
{
const
formList
=
[
{
key
:
"F1-12"
,
type
:
"numberInput"
,
sortNum
:
"2"
,
label
:
"轻改问界鸿蒙个人大定触客/进群数"
,
baseSceneCode
:
[
100101
,
100102
,
100103
],
value
:
10
,
},
];
const
detail
=
{
sceneType
:
"0"
,
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
expect
(
visible
).
toHaveLength
(
0
);
});
it
(
"group 无 rules 仅有 brandId 时调休应不可见"
,
()
=>
{
const
formList
=
buildRealOffDutyFormList
().
map
((
field
)
=>
{
if
(
field
.
key
===
"F1-5"
)
{
const
{
rules
,
...
rest
}
=
field
;
return
rest
;
}
return
field
;
});
const
detail
=
{
sceneType
:
"1"
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
((
item
)
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
it
(
"group rules 仅含 min 无 keys 时调休应不可见"
,
()
=>
{
const
formList
=
buildRealOffDutyFormList
().
map
((
field
)
=>
{
if
(
field
.
key
===
"F1-5"
)
{
return
{
...
field
,
rules
:
{
min
:
0
}
};
}
return
field
;
});
const
detail
=
{
sceneType
:
"1"
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
((
item
)
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
it
(
"schema.list 非空但无 F1-5 rules 时调休应不可见"
,
()
=>
{
const
formList
=
buildRealOffDutyFormList
().
map
((
field
)
=>
{
if
(
field
.
key
===
"F1-5"
||
field
.
key
===
"F1-11"
)
{
const
{
rules
,
...
rest
}
=
field
;
return
rest
;
}
return
field
;
});
const
schemaWithoutGroupRules
=
[
{
key
:
"F1-1"
,
type
:
"radio"
,
sortNum
:
"1"
,
label
:
"今日出勤"
,
options
:
[
{
label
:
"在岗"
,
value
:
"在岗"
},
{
label
:
"调休"
,
value
:
"调休"
},
],
},
{
key
:
"F1-5"
,
type
:
"group"
,
sortNum
:
"7"
,
label
:
"问界"
,
brandId
:
[
3454
],
children
:
[],
},
{
key
:
"F1-11"
,
type
:
"group"
,
sortNum
:
"48"
,
label
:
"其他品牌"
,
filterBrandId
:
[
3454
],
children
:
[],
},
];
const
detail
=
{
sceneType
:
"1"
,
schema
:
{
list
:
schemaWithoutGroupRules
},
};
const
visible
=
filterFormListForDisplay
(
formList
,
detail
);
const
keys
=
visible
.
map
((
item
)
=>
item
.
key
);
expect
(
keys
).
toEqual
([
"F1-1"
,
"F1-12"
,
"F1-13"
,
"F1-4"
]);
});
it
(
"subform 行内 childrenShowRules 应过滤不可见列"
,
()
=>
{
it
(
"subform 行内 childrenShowRules 应过滤不可见列"
,
()
=>
{
const
subformField
=
{
const
subformField
=
{
key
:
"F3-1"
,
key
:
"F3-1"
,
...
...
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