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
0
Merge Requests
0
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
f3f03aaa
Commit
f3f03aaa
authored
Jan 04, 2026
by
史雅文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工序管理-根据采集方案刷新采集列表
parent
f0336029
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
19 deletions
+163
-19
xjrsoft-vue3/.env.development
+2
-1
xjrsoft-vue3/.gitignore
+1
-0
xjrsoft-vue3/src/views/jcsj/gxgl/components/Form.vue
+158
-16
xjrsoft-vue3/src/views/jcsj/gxgl/components/GxglModal.vue
+2
-2
No files found.
xjrsoft-vue3/.env.development
View file @
f3f03aaa
...
@@ -9,6 +9,7 @@ VITE_PUBLIC_PATH = /
...
@@ -9,6 +9,7 @@ VITE_PUBLIC_PATH = /
# 可以有多个,注意多个不能换行,否则代理将会失效
# 可以有多个,注意多个不能换行,否则代理将会失效
# VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
# VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
# VITE_PROXY=[["/api","https://vvbin.cn/test"]]
# VITE_PROXY=[["/api","https://vvbin.cn/test"]]
VITE_PROXY = [["/system","http://192.168.8.83:8080"],["/language","http://192.168.8.83:8080"],["/api","http://192.168.8.83:8080"]]
# 是否删除Console.log
# 是否删除Console.log
VITE_DROP_CONSOLE = false
VITE_DROP_CONSOLE = false
...
@@ -16,7 +17,7 @@ VITE_DROP_CONSOLE = false
...
@@ -16,7 +17,7 @@ VITE_DROP_CONSOLE = false
# 接口地址
# 接口地址
# 如果没有跨域问题,直接在这里配置即可
# 如果没有跨域问题,直接在这里配置即可
# VITE_GLOB_API_URL=http://192.168.8.73:8080
# VITE_GLOB_API_URL=http://192.168.8.73:8080
VITE_GLOB_API_URL=http://
localhost
:8080
VITE_GLOB_API_URL=http://
192.168.8.83
:8080
# 文件上传接口 可选
# 文件上传接口 可选
VITE_GLOB_UPLOAD_URL = /system/oss/upload
VITE_GLOB_UPLOAD_URL = /system/oss/upload
...
...
xjrsoft-vue3/.gitignore
View file @
f3f03aaa
...
@@ -12,6 +12,7 @@ tests/server/static/upload
...
@@ -12,6 +12,7 @@ tests/server/static/upload
.env.local
.env.local
.env.*.local
.env.*.local
.eslintcache
.eslintcache
.env.development
# Log files
# Log files
npm-debug.log*
npm-debug.log*
...
...
xjrsoft-vue3/src/views/jcsj/gxgl/components/Form.vue
View file @
f3f03aaa
...
@@ -16,10 +16,9 @@
...
@@ -16,10 +16,9 @@
import
{
formProps
,
formEventConfigs
}
from
'./config'
;
import
{
formProps
,
formEventConfigs
}
from
'./config'
;
import
SimpleForm
from
'/@/components/SimpleForm/src/SimpleForm.vue'
;
import
SimpleForm
from
'/@/components/SimpleForm/src/SimpleForm.vue'
;
import
{
addRokeProcess
,
getRokeProcess
,
updateRokeProcess
}
from
'/@/api/jcsj/gxgl'
;
import
{
addRokeProcess
,
getRokeProcess
,
updateRokeProcess
}
from
'/@/api/jcsj/gxgl'
;
import
{
getMesCollectionScheme
}
from
'/@/api/jcsj/cjfa'
;
import
{
cloneDeep
,
isString
}
from
'lodash-es'
;
import
{
cloneDeep
,
isString
}
from
'lodash-es'
;
import
{
FormDataProps
}
from
'/@/components/Designer/src/types'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
CustomButtonModal
from
'/@/components/Form/src/components/CustomButtonModal.vue'
;
import
{
FromPageType
}
from
'/@/enums/workflowEnum'
;
import
{
FromPageType
}
from
'/@/enums/workflowEnum'
;
import
{
createFormEvent
,
getFormDataEvent
,
loadFormEvent
,
submitFormEvent
,}
from
'/@/hooks/web/useFormEvent'
;
import
{
createFormEvent
,
getFormDataEvent
,
loadFormEvent
,
submitFormEvent
,}
from
'/@/hooks/web/useFormEvent'
;
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
...
@@ -37,12 +36,13 @@
...
@@ -37,12 +36,13 @@
},
},
});
});
const
systemFormRef
=
ref
();
const
systemFormRef
=
ref
();
const
data
:
{
formDataProps
:
FormDataProps
}
=
reactive
({
const
data
=
reactive
({
formDataProps
:
cloneDeep
(
formProps
),
formDataProps
:
cloneDeep
(
formProps
)
as
any
,
});
});
const
state
=
reactive
({
const
state
=
reactive
({
formModel
:
{},
formModel
:
{}
as
any
,
formInfo
:{
formId
:
''
,
formName
:
''
}
formInfo
:{
formId
:
''
,
formName
:
''
},
isUpdatingCollectionItems
:
false
,
// 防止编辑时触发更新
});
});
const
{
currentRoute
}
=
useRouter
();
const
{
currentRoute
}
=
useRouter
();
watch
(
watch
(
...
@@ -55,6 +55,103 @@
...
@@ -55,6 +55,103 @@
},
},
);
);
// 监听采集方案变化,实时更新采集项列表
watch
(
()
=>
state
.
formModel
.
collectionSchemeId
,
async
(
newVal
,
oldVal
)
=>
{
// 如果正在更新采集项列表,则不处理(防止编辑时加载数据触发)
if
(
state
.
isUpdatingCollectionItems
)
{
return
;
}
// 如果值没有变化,则不处理
if
(
newVal
===
oldVal
)
{
return
;
}
// 如果采集方案为空,清空采集项列表
if
(
!
newVal
)
{
state
.
formModel
.
mesProcessSchemeList
=
[];
await
nextTick
();
setFieldsValue
({
mesProcessSchemeList
:
[]
});
return
;
}
// 获取采集方案下的采集项列表
await
loadCollectionItemsByScheme
(
newVal
);
},
{
immediate
:
false
,
deep
:
false
,
// 不需要深度监听,只监听值的变化
},
);
// 根据采集方案ID加载采集项列表
async
function
loadCollectionItemsByScheme
(
schemeId
:
string
|
string
[])
{
// 处理采集方案可能是数组的情况(多选),取第一个
const
actualSchemeId
=
Array
.
isArray
(
schemeId
)
?
(
schemeId
.
length
>
0
?
schemeId
[
0
]
:
''
)
:
schemeId
;
if
(
!
actualSchemeId
)
{
state
.
formModel
.
mesProcessSchemeList
=
[];
await
nextTick
();
setFieldsValue
({
mesProcessSchemeList
:
[]
});
return
;
}
try
{
state
.
isUpdatingCollectionItems
=
true
;
// 先尝试通过采集方案详情获取采集项列表
try
{
const
schemeInfo
:
any
=
await
getMesCollectionScheme
(
actualSchemeId
);
// 如果采集方案详情中包含采集项列表
if
(
schemeInfo
&&
schemeInfo
.
mesCollectionSchemeItemList
&&
Array
.
isArray
(
schemeInfo
.
mesCollectionSchemeItemList
))
{
const
collectionItems
=
schemeInfo
.
mesCollectionSchemeItemList
;
// 转换为 mesProcessSchemeList 格式
const
processSchemeList
=
collectionItems
.
map
((
item
:
any
)
=>
({
id
:
item
.
id
||
''
,
collectionSchemeId
:
actualSchemeId
,
bianMa8881
:
item
.
code
||
''
,
// 编码
mingChen4867
:
item
.
name
||
''
,
// 名称
mingChen3506
:
item
.
dataType
||
item
.
contentType
||
''
,
// 数据类型
mingChen6235
:
item
.
required
||
'0'
,
// 是否必填
beiZhu2454
:
item
.
note
||
''
,
// 备注
required
:
item
.
required
||
'0'
,
note
:
item
.
note
||
''
,
}));
// 更新表单数据
state
.
formModel
.
mesProcessSchemeList
=
processSchemeList
;
// 使用 nextTick 确保数据更新后再设置到表单
await
nextTick
();
setFieldsValue
({
mesProcessSchemeList
:
processSchemeList
});
return
;
}
}
catch
(
error
)
{
console
.
warn
(
'通过采集方案详情获取采集项列表失败,尝试其他方式'
,
error
);
}
// 如果采集方案详情中没有采集项列表,尝试通过采集项API获取
// 注意:这里需要根据实际的API接口调整,可能需要通过其他方式获取
// 暂时先尝试通过采集方案的详情接口,如果失败则清空列表
state
.
formModel
.
mesProcessSchemeList
=
[];
await
nextTick
();
setFieldsValue
({
mesProcessSchemeList
:
[]
});
}
catch
(
error
)
{
console
.
error
(
'获取采集项列表失败'
,
error
);
// 如果获取失败,清空列表
state
.
formModel
.
mesProcessSchemeList
=
[];
await
nextTick
();
setFieldsValue
({
mesProcessSchemeList
:
[]
});
}
finally
{
// 确保在数据更新完成后再重置标志
await
nextTick
();
state
.
isUpdatingCollectionItems
=
false
;
}
}
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
try
{
try
{
if
(
props
.
fromPage
==
FromPageType
.
MENU
)
{
if
(
props
.
fromPage
==
FromPageType
.
MENU
)
{
...
@@ -94,12 +191,12 @@
...
@@ -94,12 +191,12 @@
// 校验form 通过返回表单数据
// 校验form 通过返回表单数据
async
function
validate
()
{
async
function
validate
()
{
let
values
=
[]
;
let
values
:
any
=
{}
;
try
{
try
{
values
=
await
systemFormRef
.
value
?.
validate
();
values
=
await
systemFormRef
.
value
?.
validate
()
||
{}
;
//添加隐藏组件
//添加隐藏组件
if
(
data
.
formDataProps
.
hiddenComponent
?.
length
)
{
if
(
data
.
formDataProps
.
hiddenComponent
?.
length
)
{
data
.
formDataProps
.
hiddenComponent
.
forEach
((
component
)
=>
{
data
.
formDataProps
.
hiddenComponent
.
forEach
((
component
:
any
)
=>
{
values
[
component
.
bindField
]
=
component
.
value
;
values
[
component
.
bindField
]
=
component
.
value
;
});
});
}
}
...
@@ -110,24 +207,44 @@
...
@@ -110,24 +207,44 @@
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async
function
setFormDataFromId
(
rowId
)
{
async
function
setFormDataFromId
(
rowId
)
{
try
{
try
{
const
record
=
await
getRokeProcess
(
rowId
);
// 编辑时设置标志,防止加载数据时触发采集方案变化监听
state
.
isUpdatingCollectionItems
=
true
;
const
record
:
any
=
await
getRokeProcess
(
rowId
);
// 先设置表单数据
setFieldsValue
(
record
);
setFieldsValue
(
record
);
// 再更新 formModel,这样 watch 不会在数据加载时触发
state
.
formModel
=
record
;
state
.
formModel
=
record
;
// 等待数据设置完成
await
nextTick
();
// 如果编辑时没有采集项列表,但采集方案存在,则加载采集项列表
if
(
record
.
collectionSchemeId
&&
(
!
record
.
mesProcessSchemeList
||
record
.
mesProcessSchemeList
.
length
===
0
))
{
// 加载采集项列表时,isUpdatingCollectionItems 已经在 loadCollectionItemsByScheme 中管理
await
loadCollectionItemsByScheme
(
record
.
collectionSchemeId
);
}
await
getFormDataEvent
(
formEventConfigs
,
state
.
formModel
,
await
getFormDataEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:获取表单数据
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:获取表单数据
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'加载表单数据失败'
,
error
);
}
finally
{
// 确保在数据加载完成后重置标志,允许后续的采集方案切换触发更新
await
nextTick
();
state
.
isUpdatingCollectionItems
=
false
;
}
}
}
}
// 辅助返回表单数据
// 辅助返回表单数据
async
function
getFieldsValue
()
{
async
function
getFieldsValue
()
{
let
values
=
[]
;
let
values
:
any
=
{}
;
try
{
try
{
values
=
await
systemFormRef
.
value
?.
getFieldsValue
();
values
=
await
systemFormRef
.
value
?.
getFieldsValue
()
||
{}
;
//添加隐藏组件
//添加隐藏组件
if
(
data
.
formDataProps
.
hiddenComponent
?.
length
)
{
if
(
data
.
formDataProps
.
hiddenComponent
?.
length
)
{
data
.
formDataProps
.
hiddenComponent
.
forEach
((
component
)
=>
{
data
.
formDataProps
.
hiddenComponent
.
forEach
((
component
:
any
)
=>
{
values
[
component
.
bindField
]
=
component
.
value
;
values
[
component
.
bindField
]
=
component
.
value
;
});
});
}
}
...
@@ -197,7 +314,34 @@
...
@@ -197,7 +314,34 @@
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
}
}
function
handleChange
(
val
)
{
function
handleChange
(
val
)
{
// 保存旧的采集方案ID,用于判断是否发生变化
const
oldCollectionSchemeId
=
state
.
formModel
.
collectionSchemeId
;
// 同步更新 state.formModel,确保 watch 能监听到变化
// 使用响应式的方式更新,确保能触发 watch
if
(
val
.
collectionSchemeId
!==
undefined
)
{
state
.
formModel
.
collectionSchemeId
=
val
.
collectionSchemeId
;
}
// 更新其他字段
Object
.
keys
(
val
).
forEach
(
key
=>
{
if
(
key
!==
'collectionSchemeId'
)
{
state
.
formModel
[
key
]
=
val
[
key
];
}
});
emits
(
'update:value'
,
val
);
emits
(
'update:value'
,
val
);
// 如果采集方案发生变化,且不在更新状态,立即触发更新
// 这样可以确保即使 watch 没有触发,也能更新采集项列表
if
(
val
.
collectionSchemeId
!==
undefined
&&
val
.
collectionSchemeId
!==
oldCollectionSchemeId
&&
!
state
.
isUpdatingCollectionItems
)
{
nextTick
(()
=>
{
if
(
!
state
.
isUpdatingCollectionItems
)
{
loadCollectionItemsByScheme
(
val
.
collectionSchemeId
);
}
});
}
}
}
async
function
sendMessageForAllIframe
()
{
async
function
sendMessageForAllIframe
()
{
try
{
try
{
...
@@ -222,4 +366,3 @@
...
@@ -222,4 +366,3 @@
});
});
</
script
>
</
script
>
\ No newline at end of file
xjrsoft-vue3/src/views/jcsj/gxgl/components/GxglModal.vue
View file @
f3f03aaa
...
@@ -148,9 +148,8 @@
...
@@ -148,9 +148,8 @@
function
customClick
(
item
)
{
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
formRef
.
value
.
resetFields
();
}
else
{
}
else
{
...
@@ -159,6 +158,7 @@
...
@@ -159,6 +158,7 @@
}
}
function
handleClose
()
{
function
handleClose
()
{
formRef
.
value
.
resetFields
();
formRef
.
value
.
resetFields
();
closeModal
();
}
}
</
script
>
</
script
>
...
...
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