Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weiqiao-vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
金民
weiqiao-vue
Commits
12109e56
Commit
12109e56
authored
Mar 20, 2026
by
sunhaiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产任务页面将从生产计划带过来的字段设置为只读
parent
4d535a31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
xjrsoft-vue3/src/views/scgl/scrw/components/Form.vue
+60
-0
No files found.
xjrsoft-vue3/src/views/scgl/scrw/components/Form.vue
View file @
12109e56
...
...
@@ -134,6 +134,66 @@ import { log } from 'node:console';
}
);
const
readonlyFields
=
[
'ywzz'
,
// 业务组织
'kh'
,
// 客户
'jhjsrq'
,
// 计划结束日期
'sfnbdd'
,
// 是否内部订单
'jsyq'
,
// 技术要求
'cpid'
// 生产产品
];
// 2. 递归查找schema的通用方法(支持嵌套Grid/SubForm)
function
findSchemaByField
(
schemas
:
any
[],
field
:
string
):
any
{
for
(
const
schema
of
schemas
)
{
// 匹配目标字段
if
(
schema
.
field
===
field
)
{
return
schema
;
}
// 递归查找Grid子项
if
(
schema
.
children
?.
length
)
{
for
(
const
child
of
schema
.
children
)
{
if
(
child
.
list
?.
length
)
{
const
res
=
findSchemaByField
(
child
.
list
,
field
);
if
(
res
)
return
res
;
}
}
}
// 递归查找Tab/SubForm子项
if
(
schema
.
component
===
'Tab'
&&
schema
.
children
?.
length
)
{
for
(
const
tab
of
schema
.
children
)
{
if
(
tab
.
list
?.
length
)
{
const
res
=
findSchemaByField
(
tab
.
list
,
field
);
if
(
res
)
return
res
;
}
}
}
}
return
null
;
}
// 3. 批量设置字段禁用状态的方法
function
setFieldsDisabled
(
isDisabled
:
boolean
)
{
readonlyFields
.
forEach
(
field
=>
{
const
schema
=
findSchemaByField
(
data
.
formDataProps
.
schemas
,
field
);
if
(
schema
&&
schema
.
componentProps
)
{
// 修改disabled属性(兼容不同组件的属性名)
schema
.
componentProps
.
disabled
=
isDisabled
;
}
});
}
// 4. 核心监听:计划编号变化时批量控制字段
watch
(
()
=>
state
.
formModel
.
jhbh
,
(
jhbhVal
)
=>
{
// 计划编号有值 → 禁用(只读);无值 → 启用
const
isDisabled
=
!!
jhbhVal
;
setFieldsDisabled
(
isDisabled
);
},
{
immediate
:
true
}
// 初始化立即执行
);
onMounted
(
async
()
=>
{
try
{
if
(
props
.
fromPage
==
FromPageType
.
MENU
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment