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
2025-07-03 17:47:01 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
23b511aa702a3752187f48345ae58be8921bd52e
23b511aa
1 parent
33f6e8d6
fix: 优化规则检查中字段初始化的逻辑
只重置在规则中出现过的字段的disabled状态,避免不必要的初始化操作
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
src/views/index.vue
src/views/index.vue
View file @
23b511a
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-03 1
1:08:36
* @LastEditTime: 2025-07-03 1
7:44:43
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -712,11 +712,21 @@ const mergeAndDeduplicate = (data) => {
const checkRules = () => {
const rule_list = formInfo.value['rule_list'] ? [...formInfo.value['rule_list']] : [];
// 初始化所有字段的规则
// 收集所有规则中涉及的字段
const fieldsInRules = new Set();
rule_list.forEach(rule => {
if (rule.field_names && Array.isArray(rule.field_names)) {
rule.field_names.forEach(fieldName => {
fieldsInRules.add(fieldName);
});
}
});
// 初始化字段规则,只重置在规则中出现过的字段
formData.value.forEach(item => {
item.x_rules = [];
//
重置disabled状态,避免上次规则影响
if (item.component_props) {
//
只重置在规则中出现过的字段的disabled状态
if (
fieldsInRules.has(item.key) &&
item.component_props) {
item.component_props.disabled = false;
}
});
...
...
Please
register
or
login
to post a comment