Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2024-07-27 10:28:44 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7f7eeda4e2424343f7a2fbb9b553b8c3947fa064
7f7eeda4
1 parent
a227be92
🐞 fix(规则应用): 处理规则问题:收作用的规则字段如果隐藏,它设置的相应字段也需要隐藏
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletions
src/views/index.vue
src/views/index.vue
View file @
7f7eeda
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-07-2
4 10:45:46
* @LastEditTime: 2024-07-2
7 10:26:54
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -875,6 +875,33 @@ const checkRules = () => {
}
}
item['component_props']['disabled'] = item.field_rules?.mode === 'SHOW' ? !condition : condition;
/**
* 处理规则问题:收作用的规则字段如果隐藏,它设置的相应字段也需要隐藏
*/
// 有规则的字段集合
let rule_keys = formInfo.value['rule_list']
.map(item => item.expr_list[0])
.map(item => item.field_name);
//
let hide_fields = []; // 规则字段下面可以应用规则的字段
formData.value?.forEach(item => {
item.field_rules?.expr_list?.forEach(expr => {
if (rule_keys?.includes(item.key)) {
// 已隐藏字段
if (item.component_props.disabled) {
formInfo.value['rule_list']?.forEach(rule => {
if (rule.expr_list[0]['field_name'] === item.key) {
hide_fields = rule.field_names;
}
})
}
}
});
})
// 隐藏字段集合里面有当前字段
if (hide_fields.includes(item.key)) {
item['component_props']['disabled'] = true;
}
}
});
}
...
...
Please
register
or
login
to post a comment