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
adb7a340
Commit
adb7a340
authored
Jan 04, 2026
by
史雅文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工序管理新增产品弹窗
parent
f3f03aaa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
152 additions
and
13 deletions
+152
-13
xjrsoft-vue3/src/components/Form/src/components/SubForm.vue
+2
-8
xjrsoft-vue3/src/views/jcsj/cjfa/components/SelectCollectionItemModal.vue
+1
-0
xjrsoft-vue3/src/views/jcsj/gxgl/components/Form.vue
+94
-1
xjrsoft-vue3/src/views/jcsj/gxgl/components/config.ts
+55
-4
No files found.
xjrsoft-vue3/src/components/Form/src/components/SubForm.vue
View file @
adb7a340
...
...
@@ -7,9 +7,7 @@
useSelectButton ||
isImport ||
isExport ||
(isDeleteSelected &&
((props.preloadType === 'api' && !props.apiConfig?.path) ||
(props.preloadType === 'dic' && !props.itemId))) ||
isDeleteSelected ||
(topButtonList && topButtonList.length > 0) ||
(!(props.multipleHeads && props.multipleHeads.length > 0) && showColunmSet)
"
...
...
@@ -42,11 +40,7 @@
<a-button
type=
"danger"
@
click=
"deleteSelectedData"
v-if=
"
isDeleteSelected &&
((props.preloadType === 'api' && !props.apiConfig?.path) ||
(props.preloadType === 'dic' && !props.itemId))
"
v-if=
"isDeleteSelected"
:disabled=
"disabled"
class=
"mr-2"
>
...
...
xjrsoft-vue3/src/views/jcsj/cjfa/components/SelectCollectionItemModal.vue
View file @
adb7a340
...
...
@@ -133,3 +133,4 @@
</
script
>
xjrsoft-vue3/src/views/jcsj/gxgl/components/Form.vue
View file @
adb7a340
...
...
@@ -17,6 +17,7 @@
import
SimpleForm
from
'/@/components/SimpleForm/src/SimpleForm.vue'
;
import
{
addRokeProcess
,
getRokeProcess
,
updateRokeProcess
}
from
'/@/api/jcsj/gxgl'
;
import
{
getMesCollectionScheme
}
from
'/@/api/jcsj/cjfa'
;
import
{
getMesBaseProductInfo
}
from
'/@/api/jcsj/cpxx'
;
import
{
cloneDeep
,
isString
}
from
'lodash-es'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
FromPageType
}
from
'/@/enums/workflowEnum'
;
...
...
@@ -24,8 +25,10 @@
import
{
changeWorkFlowForm
,
changeSchemaDisabled
}
from
'/@/hooks/web/useWorkFlowForm'
;
import
{
WorkFlowFormParams
}
from
'/@/model/workflow/bpmnConfig'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
const
{
filterFormSchemaAuth
}
=
usePermission
();
const
{
notification
}
=
useMessage
();
const
RowKey
=
'id'
;
const
emits
=
defineEmits
([
'changeUploadComponentIds'
,
'loadingCompleted'
,
'update:value'
]);
...
...
@@ -43,6 +46,7 @@
formModel
:
{}
as
any
,
formInfo
:{
formId
:
''
,
formName
:
''
},
isUpdatingCollectionItems
:
false
,
// 防止编辑时触发更新
isProcessingProductList
:
false
,
// 防止产品列表去重时触发循环更新
});
const
{
currentRoute
}
=
useRouter
();
watch
(
...
...
@@ -55,6 +59,38 @@
},
);
// 处理产品列表去重
function
deduplicateProductList
(
productList
:
any
[]):
{
uniqueList
:
any
[];
duplicateProducts
:
string
[]
}
{
if
(
!
productList
||
!
Array
.
isArray
(
productList
)
||
productList
.
length
===
0
)
{
return
{
uniqueList
:
productList
||
[],
duplicateProducts
:
[]
};
}
const
productIdMap
=
new
Map
();
const
duplicateProducts
:
string
[]
=
[];
const
uniqueList
:
any
[]
=
[];
productList
.
forEach
((
product
:
any
)
=>
{
const
productId
=
product
.
productId
;
if
(
!
productId
)
{
// 如果没有productId,直接添加(可能是新增的空行)
uniqueList
.
push
(
product
);
return
;
}
if
(
productIdMap
.
has
(
productId
))
{
// 发现重复产品
const
productName
=
product
.
mingChen2461
||
product
.
bianHao3907
||
`产品ID:
${
productId
}
`
;
duplicateProducts
.
push
(
productName
);
}
else
{
// 首次出现,添加到唯一列表
productIdMap
.
set
(
productId
,
product
);
uniqueList
.
push
(
product
);
}
});
return
{
uniqueList
,
duplicateProducts
};
}
// 监听采集方案变化,实时更新采集项列表
watch
(
()
=>
state
.
formModel
.
collectionSchemeId
,
...
...
@@ -207,11 +243,44 @@
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async
function
setFormDataFromId
(
rowId
)
{
try
{
// 编辑时设置标志,防止加载数据时触发采集方案变化监听
// 编辑时设置标志,防止加载数据时触发采集方案变化监听
和产品去重
state
.
isUpdatingCollectionItems
=
true
;
state
.
isProcessingProductList
=
true
;
const
record
:
any
=
await
getRokeProcess
(
rowId
);
// 处理产品列表数据,根据productId查询产品信息并填充编号、名称、备注
if
(
record
.
mesProcessProductList
&&
Array
.
isArray
(
record
.
mesProcessProductList
))
{
const
productList
=
record
.
mesProcessProductList
;
const
processedProductList
=
await
Promise
.
all
(
productList
.
map
(
async
(
product
:
any
)
=>
{
if
(
product
.
productId
)
{
try
{
const
productInfo
:
any
=
await
getMesBaseProductInfo
(
product
.
productId
);
// 填充产品信息到表格字段
return
{
...
product
,
bianHao3907
:
productInfo
?.
cpbh
||
''
,
// 产品编号
mingChen2461
:
productInfo
?.
cpmc
||
''
,
// 产品名称
beiZhu7713
:
productInfo
?.
bz
||
product
.
bz
||
''
,
// 备注(优先使用产品备注,如果没有则使用原有备注)
};
}
catch
(
error
)
{
console
.
warn
(
`获取产品信息失败,productId:
${
product
.
productId
}
`
,
error
);
// 如果查询失败,返回原数据
return
{
...
product
,
bianHao3907
:
product
.
bianHao3907
||
''
,
mingChen2461
:
product
.
mingChen2461
||
''
,
beiZhu7713
:
product
.
beiZhu7713
||
product
.
bz
||
''
,
};
}
}
return
product
;
})
);
record
.
mesProcessProductList
=
processedProductList
;
}
// 先设置表单数据
setFieldsValue
(
record
);
// 再更新 formModel,这样 watch 不会在数据加载时触发
...
...
@@ -235,6 +304,7 @@
// 确保在数据加载完成后重置标志,允许后续的采集方案切换触发更新
await
nextTick
();
state
.
isUpdatingCollectionItems
=
false
;
state
.
isProcessingProductList
=
false
;
}
}
// 辅助返回表单数据
...
...
@@ -317,6 +387,29 @@
// 保存旧的采集方案ID,用于判断是否发生变化
const
oldCollectionSchemeId
=
state
.
formModel
.
collectionSchemeId
;
// 处理产品列表去重(在更新formModel之前)
if
(
val
.
mesProcessProductList
&&
Array
.
isArray
(
val
.
mesProcessProductList
)
&&
!
state
.
isProcessingProductList
)
{
const
{
uniqueList
,
duplicateProducts
}
=
deduplicateProductList
(
val
.
mesProcessProductList
);
// 如果有重复产品,进行去重并提示
if
(
duplicateProducts
.
length
>
0
)
{
state
.
isProcessingProductList
=
true
;
val
.
mesProcessProductList
=
uniqueList
;
// 立即更新表单数据,确保去重后的数据反映到表单中
nextTick
(()
=>
{
setFieldsValue
({
mesProcessProductList
:
uniqueList
});
state
.
isProcessingProductList
=
false
;
});
notification
.
warning
({
message
:
'提示'
,
description
:
`以下产品已存在,已自动去除重复项:
${
duplicateProducts
.
join
(
'、'
)}
`
,
duration
:
3
,
});
}
}
// 同步更新 state.formModel,确保 watch 能监听到变化
// 使用响应式的方式更新,确保能触发 watch
if
(
val
.
collectionSchemeId
!==
undefined
)
{
...
...
xjrsoft-vue3/src/views/jcsj/gxgl/components/config.ts
View file @
adb7a340
...
...
@@ -573,6 +573,7 @@ export const formProps: FormProps = {
bordered
:
true
,
isShowAi
:
false
,
tooltipConfig
:
{
visible
:
false
,
title
:
'提示文本'
},
prestrainField
:
'id'
,
},
},
{
...
...
@@ -603,6 +604,7 @@ export const formProps: FormProps = {
bordered
:
true
,
isShowAi
:
false
,
tooltipConfig
:
{
visible
:
false
,
title
:
'提示文本'
},
prestrainField
:
'cpbh'
,
},
},
{
...
...
@@ -633,6 +635,7 @@ export const formProps: FormProps = {
bordered
:
true
,
isShowAi
:
false
,
tooltipConfig
:
{
visible
:
false
,
title
:
'提示文本'
},
prestrainField
:
'cpmc'
,
},
},
{
...
...
@@ -713,11 +716,59 @@ export const formProps: FormProps = {
],
span
:
'24'
,
preloadType
:
'api'
,
apiConfig
:
{},
apiConfig
:
{
path
:
'/scgl/scjh/getAllProduct'
,
method
:
'GET'
,
apiId
:
'f4fbb57f2f18425e97918a031c8aa7d8'
,
apiParams
:
[
{
key
:
'1'
,
title
:
'Query Params'
,
tableInfo
:
[]
},
{
key
:
'2'
,
title
:
'Header'
,
tableInfo
:
[]
},
{
key
:
'3'
,
title
:
'Body'
},
],
script
:
"var sql = 'select *,id as value,cpmc as label from mes_base_product_info where delete_mark=0';
\
r
\
nreturn db.select(sql)"
,
outputParams
:
[
{
name
:
'id'
,
tableTitle
:
'产品ID'
,
bindField
:
'productId'
,
show
:
false
,
width
:
150
,
},
{
name
:
'cpbh'
,
tableTitle
:
'产品编号'
,
bindField
:
'bianHao3907'
,
show
:
true
,
width
:
150
,
},
{
name
:
'cpmc'
,
tableTitle
:
'产品名称'
,
bindField
:
'mingChen2461'
,
show
:
true
,
width
:
150
,
},
{
name
:
'gg'
,
tableTitle
:
'产品规格'
,
bindField
:
'cpgg'
,
show
:
true
,
width
:
150
,
},
{
name
:
'xh'
,
tableTitle
:
'产品型号'
,
bindField
:
'cpxh'
,
show
:
true
,
width
:
150
,
},
],
},
itemId
:
''
,
dicOptions
:
[],
useSelectButton
:
fals
e
,
buttonName
:
'
选择数据
'
,
useSelectButton
:
tru
e
,
buttonName
:
'
+ 新增
'
,
showLabel
:
true
,
showComponentBorder
:
true
,
showBorder
:
false
,
...
...
@@ -734,7 +785,7 @@ export const formProps: FormProps = {
isDeleteSelected
:
true
,
isListView
:
false
,
viewList
:
[],
isShowAdd
:
tru
e
,
isShowAdd
:
fals
e
,
isShowDelete
:
true
,
hasCheckedCol
:
true
,
events
:
{},
...
...
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