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
2e07ad3f
Commit
2e07ad3f
authored
Jan 23, 2026
by
史雅文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
来料、过程、成品入库和发货质检单弹窗质检明细和质检方案关联
parent
7fe9c7af
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
375 additions
and
72 deletions
+375
-72
xjrsoft-vue3/.env.development
+2
-2
xjrsoft-vue3/src/views/zlgl/bhgpcl/components/BhgpclModal.vue
+9
-3
xjrsoft-vue3/src/views/zlgl/cgzjd/components/CgzjdModal.vue
+9
-3
xjrsoft-vue3/src/views/zlgl/cgzjd/components/Form.vue
+65
-2
xjrsoft-vue3/src/views/zlgl/cgzjd/components/config.ts
+24
-6
xjrsoft-vue3/src/views/zlgl/cprkzjd/components/CprkzjdModal.vue
+22
-5
xjrsoft-vue3/src/views/zlgl/cprkzjd/components/Form.vue
+65
-0
xjrsoft-vue3/src/views/zlgl/cprkzjd/components/config.ts
+10
-4
xjrsoft-vue3/src/views/zlgl/fhzj/components/FhzjModal.vue
+9
-3
xjrsoft-vue3/src/views/zlgl/fhzjd/components/FhzjdModal.vue
+16
-5
xjrsoft-vue3/src/views/zlgl/fhzjd/components/Form.vue
+61
-0
xjrsoft-vue3/src/views/zlgl/fhzjd/components/config.ts
+24
-7
xjrsoft-vue3/src/views/zlgl/llzjd/components/Form.vue
+40
-25
xjrsoft-vue3/src/views/zlgl/llzjd/components/LlzjdModal.vue
+10
-4
xjrsoft-vue3/src/views/zlgl/qtzjd/components/QtzjdModal.vue
+9
-3
No files found.
xjrsoft-vue3/.env.development
View file @
2e07ad3f
...
...
@@ -9,14 +9,14 @@ VITE_PUBLIC_PATH = /
# 可以有多个,注意多个不能换行,否则代理将会失效
# VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
# 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
"]]
VITE_PROXY = [["/system","http://192.168.8.
149:8053"],["/language","http://192.168.8.149:8053"],["/api","http://192.168.8.149:8053
"]]
# 是否删除Console.log
VITE_DROP_CONSOLE = false
# 接口地址
# 如果没有跨域问题,直接在这里配置即可
VITE_GLOB_API_URL=http://
localhost:8080
VITE_GLOB_API_URL=http://
192.168.8.149:8053
# 文件上传接口 可选
VITE_GLOB_UPLOAD_URL = /system/oss/upload
...
...
xjrsoft-vue3/src/views/zlgl/bhgpcl/components/BhgpclModal.vue
View file @
2e07ad3f
...
...
@@ -148,9 +148,8 @@
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
}
else
{
...
...
@@ -158,7 +157,14 @@
}
}
function
handleClose
()
{
formRef
.
value
.
resetFields
();
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'关闭弹窗时重置表单失败:'
,
error
);
});
}
</
script
>
...
...
xjrsoft-vue3/src/views/zlgl/cgzjd/components/CgzjdModal.vue
View file @
2e07ad3f
...
...
@@ -148,9 +148,8 @@
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
}
else
{
...
...
@@ -158,7 +157,14 @@
}
}
function
handleClose
()
{
formRef
.
value
.
resetFields
();
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'关闭弹窗时重置表单失败:'
,
error
);
});
}
</
script
>
...
...
xjrsoft-vue3/src/views/zlgl/cgzjd/components/Form.vue
View file @
2e07ad3f
<
template
>
<div
class=
"pt-4"
>
<SimpleForm
...
...
@@ -19,12 +18,13 @@
import
{
cloneDeep
,
isString
}
from
'lodash-es'
;
import
{
FormDataProps
}
from
'/@/components/Designer/src/types'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
CustomButtonModal
from
'/@/components/Form/src/components/CustomButtonModal.vue'
;
import
{
FromPageType
}
from
'/@/enums/workflowEnum'
;
import
{
createFormEvent
,
getFormDataEvent
,
loadFormEvent
,
submitFormEvent
,}
from
'/@/hooks/web/useFormEvent'
;
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
import
{
WorkFlowFormParams
}
from
'/@/model/workflow/bpmnConfig'
;
import
{
useRouter
}
from
'vue-router'
;
import
axios
from
'axios'
;
import
{
notification
}
from
'ant-design-vue'
;
const
{
filterFormSchemaAuth
}
=
usePermission
();
...
...
@@ -54,6 +54,60 @@
deep
:
true
,
},
);
// 质检方案联动:根据方案id从接口获取明细,并整体替换当前明细列表
let
zjfaReqSeq
=
0
;
async
function
handleZjfaChange
(
zjfaId
:
string
)
{
const
seq
=
++
zjfaReqSeq
;
try
{
const
resp
=
await
axios
.
get
(
import
.
meta
.
env
.
VITE_GLOB_API_URL
+
'/magic-api/zlgl/zjjcsj/getFaById'
,
{
params
:
{
id
:
zjfaId
}
},
);
// 若请求已过期(用户快速切换了方案),丢弃旧响应,避免串台
if
(
seq
!==
zjfaReqSeq
)
return
;
const
list
=
(
resp
as
any
)?.
data
?.
data
??
[];
// 用接口返回 data 列表整体替换当前明细
const
detailList
=
Array
.
isArray
(
list
)
?
list
.
map
((
item
:
any
)
=>
({
bzz
:
item
.
bzz
,
bh
:
item
.
bh
,
zjxm
:
item
.
mc
,
bz
:
item
.
bz
,
jyyf
:
item
.
zjfs
,
}))
:
[];
// 用“整对象替换”触发表单/子表重新渲染(很多实现只监听 formModel 引用变化)
const
nextModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
detailList
,
};
state
.
formModel
=
nextModel
;
// 显式同步到表单实例(SubForm 需要 setFieldsValue 才会立刻刷新)
systemFormRef
.
value
?.
setFieldsValue
?.(
nextModel
);
}
catch
(
error
)
{
if
(
seq
!==
zjfaReqSeq
)
return
;
console
.
error
(
'获取质检方案详情失败:'
,
error
);
notification
.
error
({
message
:
'获取质检详情失败'
});
state
.
formModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
[]
};
systemFormRef
.
value
?.
setFieldsValue
?.({
mesQualityInspectionDetailList
:
[]
});
}
}
// 监听质检方案字段,选择/切换方案时刷新质检明细列表
watch
(
()
=>
(
state
.
formModel
as
any
)?.
zjfa
,
async
(
newZjfaId
)
=>
{
if
(
!
newZjfaId
)
{
state
.
formModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
[]
};
systemFormRef
.
value
?.
setFieldsValue
?.({
mesQualityInspectionDetailList
:
[]
});
return
;
}
await
handleZjfaChange
(
newZjfaId
);
},
);
onMounted
(
async
()
=>
{
try
{
...
...
@@ -116,6 +170,13 @@
await
getFormDataEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:获取表单数据
// 打开编辑弹窗时:用当前方案id刷新明细(放在 getFormDataEvent 后,避免被其覆盖)
await
nextTick
();
const
zjfaId
=
(
state
.
formModel
as
any
)?.
zjfa
;
if
(
zjfaId
)
{
await
handleZjfaChange
(
zjfaId
);
}
}
catch
(
error
)
{
}
...
...
@@ -197,6 +258,8 @@
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
}
function
handleChange
(
val
)
{
// 同步内部表单模型,确保 watch(zjfa) 能触发联动更新明细
state
.
formModel
=
val
??
{};
emits
(
'update:value'
,
val
);
}
async
function
sendMessageForAllIframe
()
{
...
...
xjrsoft-vue3/src/views/zlgl/cgzjd/components/config.ts
View file @
2e07ad3f
...
...
@@ -80,8 +80,19 @@ export const searchFormSchema: FormSchema[] = [
defaultValue
:
undefined
,
component
:
'XjrSelect'
,
componentProps
:
{
datasourceType
:
'staticData'
,
staticOptions
:
[{
key
:
1
,
label
:
'方案1'
,
value
:
'方案1'
}],
datasourceType
:
'api'
,
apiConfig
:
{
path
:
'/zlgl/zjjcsj/getZjfa'
,
method
:
'GET'
,
apiId
:
'ae3834298bc54c2fb66e9e9af18765e6'
,
apiParams
:
[
{
key
:
'1'
,
title
:
'Query Params'
,
tableInfo
:
[]
},
{
key
:
'2'
,
title
:
'Header'
,
tableInfo
:
[]
},
{
key
:
'3'
,
title
:
'Body'
},
],
script
:
"var sql = 'select *,id as value,mc as label from mes_quality_inspection_plan where delete_mark=0';
\
r
\
nreturn db.select(sql)"
,
},
labelField
:
'label'
,
valueField
:
'value'
,
mode
:
'multiple'
,
...
...
@@ -595,14 +606,21 @@ export const formProps: FormProps = {
clearable
:
false
,
disabled
:
false
,
staticOptions
:
[{
key
:
1
,
label
:
'方案1'
,
value
:
'方案1'
}],
defaultSelect
:
''
,
datasourceType
:
'
staticData
'
,
defaultSelect
:
null
,
datasourceType
:
'
api
'
,
labelField
:
'label'
,
valueField
:
'value'
,
apiConfig
:
{
path
:
'
CodeGeneration/selection
'
,
path
:
'
/zlgl/zjjcsj/getZjfa
'
,
method
:
'GET'
,
apiId
:
'93d735dcb7364a0f8102188ec4d77ac7'
,
apiId
:
'ae3834298bc54c2fb66e9e9af18765e6'
,
apiParams
:
[
{
key
:
'1'
,
title
:
'Query Params'
,
tableInfo
:
[]
},
{
key
:
'2'
,
title
:
'Header'
,
tableInfo
:
[]
},
{
key
:
'3'
,
title
:
'Body'
},
],
script
:
"var sql = 'select *,id as value,mc as label from mes_quality_inspection_plan where delete_mark=0';
\
r
\
nreturn db.select(sql)"
,
},
dicOptions
:
[],
required
:
false
,
...
...
xjrsoft-vue3/src/views/zlgl/cprkzjd/components/CprkzjdModal.vue
View file @
2e07ad3f
...
...
@@ -134,10 +134,21 @@
});
//提示消息
}
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
formRef
.
value
.
resetFields
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'提交成功后重置表单失败:'
,
error
);
});
emit
(
'success'
);
}
else
{
// 明确提示:保存未成功时不关闭弹窗(通常是校验不通过/接口失败)
notification
.
warning
({
message
:
'Tip'
,
description
:
'保存未成功,请检查必填项或接口报错信息后重试'
,
});
}
}
finally
{
...
...
@@ -148,9 +159,8 @@
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
}
else
{
...
...
@@ -158,7 +168,14 @@
}
}
function
handleClose
()
{
formRef
.
value
.
resetFields
();
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'关闭弹窗时重置表单失败:'
,
error
);
});
}
</
script
>
...
...
xjrsoft-vue3/src/views/zlgl/cprkzjd/components/Form.vue
View file @
2e07ad3f
...
...
@@ -25,6 +25,8 @@
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
import
{
WorkFlowFormParams
}
from
'/@/model/workflow/bpmnConfig'
;
import
{
useRouter
}
from
'vue-router'
;
import
axios
from
'axios'
;
import
{
notification
}
from
'ant-design-vue'
;
const
{
filterFormSchemaAuth
}
=
usePermission
();
...
...
@@ -54,6 +56,60 @@
deep
:
true
,
},
);
// 质检方案联动:根据方案id从接口获取明细,并整体替换当前明细列表
let
zjfaReqSeq
=
0
;
async
function
handleZjfaChange
(
zjfaId
:
string
)
{
const
seq
=
++
zjfaReqSeq
;
try
{
const
resp
=
await
axios
.
get
(
import
.
meta
.
env
.
VITE_GLOB_API_URL
+
'/magic-api/zlgl/zjjcsj/getFaById'
,
{
params
:
{
id
:
zjfaId
}
},
);
// 若请求已过期(用户快速切换了方案),丢弃旧响应,避免串台
if
(
seq
!==
zjfaReqSeq
)
return
;
const
list
=
(
resp
as
any
)?.
data
?.
data
??
[];
// 用接口返回 data 列表整体替换当前明细
const
detailList
=
Array
.
isArray
(
list
)
?
list
.
map
((
item
:
any
)
=>
({
bzz
:
item
.
bzz
,
bh
:
item
.
bh
,
zjxm
:
item
.
mc
,
bz
:
item
.
bz
,
jyyf
:
item
.
zjfs
,
}))
:
[];
// 用"整对象替换"触发表单/子表重新渲染(很多实现只监听 formModel 引用变化)
const
nextModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
detailList
,
};
state
.
formModel
=
nextModel
;
// 显式同步到表单实例(SubForm 需要 setFieldsValue 才会立刻刷新)
systemFormRef
.
value
?.
setFieldsValue
?.(
nextModel
);
}
catch
(
error
)
{
if
(
seq
!==
zjfaReqSeq
)
return
;
console
.
error
(
'获取质检方案详情失败:'
,
error
);
notification
.
error
({
message
:
'获取质检详情失败'
});
state
.
formModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
[]
};
systemFormRef
.
value
?.
setFieldsValue
?.({
mesQualityInspectionDetailList
:
[]
});
}
}
// 监听质检方案字段,选择/切换方案时刷新质检明细列表
watch
(
()
=>
(
state
.
formModel
as
any
)?.
zjfa
,
async
(
newZjfaId
)
=>
{
if
(
!
newZjfaId
)
{
state
.
formModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
[]
};
systemFormRef
.
value
?.
setFieldsValue
?.({
mesQualityInspectionDetailList
:
[]
});
return
;
}
await
handleZjfaChange
(
newZjfaId
);
},
);
onMounted
(
async
()
=>
{
try
{
...
...
@@ -116,6 +172,13 @@
await
getFormDataEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:获取表单数据
// 打开编辑弹窗时:用当前方案id刷新明细(放在 getFormDataEvent 后,避免被其覆盖)
await
nextTick
();
const
zjfaId
=
(
state
.
formModel
as
any
)?.
zjfa
;
if
(
zjfaId
)
{
await
handleZjfaChange
(
zjfaId
);
}
}
catch
(
error
)
{
}
...
...
@@ -197,6 +260,8 @@
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
}
function
handleChange
(
val
)
{
// 新增/编辑弹窗字段变化时,同步 formModel,确保 watch(zjfa) 能触发联动
state
.
formModel
=
val
??
{};
emits
(
'update:value'
,
val
);
}
async
function
sendMessageForAllIframe
()
{
...
...
xjrsoft-vue3/src/views/zlgl/cprkzjd/components/config.ts
View file @
2e07ad3f
...
...
@@ -440,15 +440,21 @@ export const formProps: FormProps = {
isMultiple
:
false
,
clearable
:
false
,
disabled
:
false
,
staticOptions
:
[{
key
:
1
,
label
:
'方案1'
,
value
:
'方案1'
}],
defaultSelect
:
''
,
datasourceType
:
'
staticData
'
,
datasourceType
:
'
api
'
,
labelField
:
'label'
,
valueField
:
'value'
,
apiConfig
:
{
path
:
'
CodeGeneration/selection
'
,
path
:
'
/zlgl/zjjcsj/getZjfa
'
,
method
:
'GET'
,
apiId
:
'93d735dcb7364a0f8102188ec4d77ac7'
,
apiId
:
'ae3834298bc54c2fb66e9e9af18765e6'
,
apiParams
:
[
{
key
:
'1'
,
title
:
'Query Params'
,
tableInfo
:
[]
},
{
key
:
'2'
,
title
:
'Header'
,
tableInfo
:
[]
},
{
key
:
'3'
,
title
:
'Body'
},
],
script
:
"var sql = 'select *,id as value,mc as label from mes_quality_inspection_plan where delete_mark=0';
\
r
\
nreturn db.select(sql)"
,
},
dicOptions
:
[],
required
:
false
,
...
...
xjrsoft-vue3/src/views/zlgl/fhzj/components/FhzjModal.vue
View file @
2e07ad3f
...
...
@@ -148,9 +148,8 @@
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
}
else
{
...
...
@@ -158,7 +157,14 @@
}
}
function
handleClose
()
{
formRef
.
value
.
resetFields
();
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'关闭弹窗时重置表单失败:'
,
error
);
});
}
</
script
>
...
...
xjrsoft-vue3/src/views/zlgl/fhzjd/components/FhzjdModal.vue
View file @
2e07ad3f
...
...
@@ -134,9 +134,14 @@
});
//提示消息
}
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
formRef
.
value
.
resetFields
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'提交成功后重置表单失败:'
,
error
);
});
emit
(
'success'
);
}
}
finally
{
...
...
@@ -148,9 +153,8 @@
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
}
else
{
...
...
@@ -158,7 +162,14 @@
}
}
function
handleClose
()
{
formRef
.
value
.
resetFields
();
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'关闭弹窗时重置表单失败:'
,
error
);
});
}
</
script
>
...
...
xjrsoft-vue3/src/views/zlgl/fhzjd/components/Form.vue
View file @
2e07ad3f
...
...
@@ -25,6 +25,8 @@
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
import
{
WorkFlowFormParams
}
from
'/@/model/workflow/bpmnConfig'
;
import
{
useRouter
}
from
'vue-router'
;
import
axios
from
'axios'
;
import
{
notification
}
from
'ant-design-vue'
;
const
{
filterFormSchemaAuth
}
=
usePermission
();
...
...
@@ -54,6 +56,56 @@
deep
:
true
,
},
);
// 质检方案联动:根据方案id从接口获取明细,并整体替换当前明细列表
let
zjfaReqSeq
=
0
;
async
function
handleZjfaChange
(
zjfaId
:
string
)
{
const
seq
=
++
zjfaReqSeq
;
try
{
const
resp
=
await
axios
.
get
(
import
.
meta
.
env
.
VITE_GLOB_API_URL
+
'/magic-api/zlgl/zjjcsj/getFaById'
,
{
params
:
{
id
:
zjfaId
}
},
);
// 若请求已过期(用户快速切换了方案),丢弃旧响应,避免串台
if
(
seq
!==
zjfaReqSeq
)
return
;
const
list
=
(
resp
as
any
)?.
data
?.
data
??
[];
const
detailList
=
Array
.
isArray
(
list
)
?
list
.
map
((
item
:
any
)
=>
({
bzz
:
item
.
bzz
,
bh
:
item
.
bh
,
zjxm
:
item
.
mc
,
bz
:
item
.
bz
,
jyyf
:
item
.
zjfs
,
}))
:
[];
const
nextModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
detailList
,
};
state
.
formModel
=
nextModel
;
systemFormRef
.
value
?.
setFieldsValue
?.(
nextModel
);
}
catch
(
error
)
{
if
(
seq
!==
zjfaReqSeq
)
return
;
console
.
error
(
'获取质检方案详情失败:'
,
error
);
notification
.
error
({
message
:
'获取质检详情失败'
});
state
.
formModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
[]
};
systemFormRef
.
value
?.
setFieldsValue
?.({
mesQualityInspectionDetailList
:
[]
});
}
}
watch
(
()
=>
(
state
.
formModel
as
any
)?.
zjfa
,
async
(
newZjfaId
)
=>
{
if
(
!
newZjfaId
)
{
state
.
formModel
=
{
...(
state
.
formModel
as
any
),
mesQualityInspectionDetailList
:
[]
};
systemFormRef
.
value
?.
setFieldsValue
?.({
mesQualityInspectionDetailList
:
[]
});
return
;
}
await
handleZjfaChange
(
newZjfaId
);
},
);
onMounted
(
async
()
=>
{
try
{
...
...
@@ -116,6 +168,13 @@
await
getFormDataEvent
(
formEventConfigs
,
state
.
formModel
,
systemFormRef
.
value
,
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:获取表单数据
// 打开编辑弹窗时:用当前方案id刷新明细(放在 getFormDataEvent 后,避免被其覆盖)
await
nextTick
();
const
zjfaId
=
(
state
.
formModel
as
any
)?.
zjfa
;
if
(
zjfaId
)
{
await
handleZjfaChange
(
zjfaId
);
}
}
catch
(
error
)
{
}
...
...
@@ -197,6 +256,8 @@
formProps
.
schemas
,
true
,
state
.
formInfo
.
formName
,
state
.
formInfo
.
formId
);
//表单事件:加载表单
}
function
handleChange
(
val
)
{
// 同步内部表单模型,确保 watch(zjfa) 能触发联动
state
.
formModel
=
val
??
{};
emits
(
'update:value'
,
val
);
}
async
function
sendMessageForAllIframe
()
{
...
...
xjrsoft-vue3/src/views/zlgl/fhzjd/components/config.ts
View file @
2e07ad3f
...
...
@@ -80,8 +80,19 @@ export const searchFormSchema: FormSchema[] = [
defaultValue
:
undefined
,
component
:
'XjrSelect'
,
componentProps
:
{
datasourceType
:
'staticData'
,
staticOptions
:
[{
key
:
1
,
label
:
'方案1'
,
value
:
'方案1'
}],
datasourceType
:
'api'
,
apiConfig
:
{
path
:
'/zlgl/zjjcsj/getZjfa'
,
method
:
'GET'
,
apiId
:
'ae3834298bc54c2fb66e9e9af18765e6'
,
apiParams
:
[
{
key
:
'1'
,
title
:
'Query Params'
,
tableInfo
:
[]
},
{
key
:
'2'
,
title
:
'Header'
,
tableInfo
:
[]
},
{
key
:
'3'
,
title
:
'Body'
},
],
script
:
"var sql = 'select *,id as value,mc as label from mes_quality_inspection_plan where delete_mark=0';
\
r
\
nreturn db.select(sql)"
,
},
labelField
:
'label'
,
valueField
:
'value'
,
mode
:
'multiple'
,
...
...
@@ -607,15 +618,21 @@ export const formProps: FormProps = {
isMultiple
:
false
,
clearable
:
false
,
disabled
:
false
,
staticOptions
:
[{
key
:
1
,
label
:
'方案1'
,
value
:
'方案1'
}],
defaultSelect
:
''
,
datasourceType
:
'staticData'
,
defaultSelect
:
null
,
datasourceType
:
'api'
,
labelField
:
'label'
,
valueField
:
'value'
,
apiConfig
:
{
path
:
'
CodeGeneration/selection
'
,
path
:
'
/zlgl/zjjcsj/getZjfa
'
,
method
:
'GET'
,
apiId
:
'93d735dcb7364a0f8102188ec4d77ac7'
,
apiId
:
'ae3834298bc54c2fb66e9e9af18765e6'
,
apiParams
:
[
{
key
:
'1'
,
title
:
'Query Params'
,
tableInfo
:
[]
},
{
key
:
'2'
,
title
:
'Header'
,
tableInfo
:
[]
},
{
key
:
'3'
,
title
:
'Body'
},
],
script
:
"var sql = 'select *,id as value,mc as label from mes_quality_inspection_plan where delete_mark=0';
\
r
\
nreturn db.select(sql)"
,
},
dicOptions
:
[],
required
:
false
,
...
...
xjrsoft-vue3/src/views/zlgl/llzjd/components/Form.vue
View file @
2e07ad3f
...
...
@@ -68,36 +68,49 @@
watch
(
()
=>
formModel
.
value
.
zjfa
,
(
newZjfaId
)
=>
{
if
(
newZjfaId
)
{
async
(
newZjfaId
)
=>
{
if
(
!
newZjfaId
)
{
formModel
.
value
.
mesQualityInspectionDetailList
=
[];
try
{
axios
.
get
(
import
.
meta
.
env
.
VITE_GLOB_API_URL
+
'/magic-api/zlgl/zjjcsj/getFaById'
,
{
params
:
{
id
:
newZjfaId
},
})
.
then
((
response
)
=>
{
for
(
const
item
of
response
.
data
.
data
)
{
formModel
.
value
.
mesQualityInspectionDetailList
.
push
({
bzz
:
item
.
bzz
,
bh
:
item
.
bh
,
zjxm
:
item
.
mc
,
bz
:
item
.
bz
,
jyyf
:
item
.
zjfs
,
});
}
});
}
catch
(
error
)
{
console
.
error
(
'获取质检方案详情失败:'
,
error
);
notification
.
error
({
message
:
'获取质检详情失败'
});
}
return
;
}
},
{
deep
:
true
,
await
handleZjfaChange
(
newZjfaId
);
},
);
// 质检方案变化:根据方案id从接口获取明细,并整体替换当前明细列表
let
zjfaReqSeq
=
0
;
async
function
handleZjfaChange
(
zjfaId
:
string
)
{
const
seq
=
++
zjfaReqSeq
;
try
{
const
resp
=
await
axios
.
get
(
import
.
meta
.
env
.
VITE_GLOB_API_URL
+
'/magic-api/zlgl/zjjcsj/getFaById'
,
{
params
:
{
id
:
zjfaId
},
},
);
// 若请求已过期(用户快速切换了方案),丢弃旧响应,避免串台
if
(
seq
!==
zjfaReqSeq
)
return
;
const
list
=
(
resp
as
any
)?.
data
?.
data
??
[];
formModel
.
value
.
mesQualityInspectionDetailList
=
Array
.
isArray
(
list
)
?
list
.
map
((
item
:
any
)
=>
({
bzz
:
item
.
bzz
,
bh
:
item
.
bh
,
zjxm
:
item
.
mc
,
bz
:
item
.
bz
,
jyyf
:
item
.
zjfs
,
}))
:
[];
}
catch
(
error
)
{
if
(
seq
!==
zjfaReqSeq
)
return
;
console
.
error
(
'获取质检方案详情失败:'
,
error
);
notification
.
error
({
message
:
'获取质检详情失败'
});
// 请求失败时,保持可预期:清空明细,避免展示旧方案的数据
formModel
.
value
.
mesQualityInspectionDetailList
=
[];
}
}
onMounted
(
async
()
=>
{
try
{
if
(
props
.
fromPage
==
FromPageType
.
MENU
)
{
...
...
@@ -305,6 +318,8 @@
);
//表单事件:加载表单
}
function
handleChange
(
val
)
{
// 新增/编辑弹窗内字段变化时,同步 formModel,确保 watch(zjfa) 能触发联动更新明细
formModel
.
value
=
val
??
{};
emits
(
'update:value'
,
val
);
}
async
function
sendMessageForAllIframe
()
{
...
...
xjrsoft-vue3/src/views/zlgl/llzjd/components/LlzjdModal.vue
View file @
2e07ad3f
...
...
@@ -148,17 +148,23 @@
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
formRef
.
value
?
.
resetFields
();
}
else
{
executeCurFormEvent
(
item
.
event
,
state
.
formModel
,
true
);
}
}
function
handleClose
()
{
formRef
.
value
.
resetFields
();
// 先关闭弹窗:避免 resetFields 内部异步/卡住导致“无法关闭”的体验
closeModal
();
// 再异步重置表单:不阻塞关闭
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'关闭时重置表单失败:'
,
error
);
});
}
</
script
>
...
...
xjrsoft-vue3/src/views/zlgl/qtzjd/components/QtzjdModal.vue
View file @
2e07ad3f
...
...
@@ -148,9 +148,8 @@
function
customClick
(
item
)
{
if
(
item
.
key
==
'confirm'
)
{
handleSubmit
();
}
else
if
(
item
.
key
==
'cancel'
&&
props
.
formType
!==
'normal'
)
{
}
else
if
(
item
.
key
==
'cancel'
)
{
handleClose
();
closeModal
();
}
else
if
(
item
.
key
==
'reset'
)
{
formRef
.
value
.
resetFields
();
}
else
{
...
...
@@ -158,7 +157,14 @@
}
}
function
handleClose
()
{
formRef
.
value
.
resetFields
();
// 先关闭弹窗,避免 resetFields 的异步/报错阻塞关闭
closeModal
();
// 再异步重置表单,不影响关闭体验
Promise
.
resolve
()
.
then
(()
=>
formRef
.
value
?.
resetFields
?.())
.
catch
((
error
)
=>
{
console
.
error
(
'关闭弹窗时重置表单失败:'
,
error
);
});
}
</
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