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
26c03b64
Commit
26c03b64
authored
Dec 31, 2025
by
史雅文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理采集项bug
parent
c4924f07
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
144 additions
and
293 deletions
+144
-293
xjrsoft-vue3/.env.development
+2
-2
xjrsoft-vue3/src/api/jcsj/cjx/index.ts
+0
-15
xjrsoft-vue3/src/components/Form/src/components/SubForm.vue
+1
-10
xjrsoft-vue3/src/views/jcsj/cjfa/components/CollectionItemSelectModal.vue
+0
-225
xjrsoft-vue3/src/views/jcsj/cjfa/components/Form.vue
+0
-0
xjrsoft-vue3/src/views/jcsj/cjfa/components/SelectCollectionItemModal.vue
+135
-0
xjrsoft-vue3/src/views/jcsj/cjfa/components/collectionItemColumns.ts
+0
-27
xjrsoft-vue3/src/views/jcsj/cjfa/components/config.ts
+6
-14
No files found.
xjrsoft-vue3/.env.development
View file @
26c03b64
...
...
@@ -6,13 +6,13 @@ VITE_PUBLIC_PATH=/
# 本地开发代理(解决跨域)
# 所有匹配前缀的请求将被代理到目标服务器
VITE_PROXY=[["/system","http://
localhost:8080"],["/language","http://localhost:8080"],["/api","http://localhost
:8080"]]
VITE_PROXY=[["/system","http://
192.168.8.136:8080"],["/language","http://192.168.8.136:8080"],["/api","http://192.168.8.136
:8080"]]
# 是否删除Console.log
VITE_DROP_CONSOLE=false
# 接口地址(用于代码中生成 baseURL)
VITE_GLOB_API_URL=http://
localhost
:8080
VITE_GLOB_API_URL=http://
192.168.8.136
:8080
# 文件上传接口
VITE_GLOB_UPLOAD_URL=/system/oss/upload
...
...
xjrsoft-vue3/src/api/jcsj/cjx/index.ts
View file @
26c03b64
...
...
@@ -29,21 +29,6 @@ export async function getMesCollectionItemPage(params: MesCollectionItemPagePara
}
/**
* @description: 查询MesCollectionItem列表(不分页)
*/
export
async
function
getMesCollectionItemList
(
params
?:
MesCollectionItemPageParams
,
mode
:
ErrorMessageMode
=
'modal'
)
{
return
defHttp
.
get
<
MesCollectionItemPageModel
[]
>
(
{
url
:
Api
.
List
,
params
,
},
{
errorMessageMode
:
mode
,
},
);
}
/**
* @description: 获取MesCollectionItem信息
*/
export
async
function
getMesCollectionItem
(
id
:
String
,
mode
:
ErrorMessageMode
=
'modal'
)
{
...
...
xjrsoft-vue3/src/components/Form/src/components/SubForm.vue
View file @
26c03b64
...
...
@@ -1667,21 +1667,12 @@
localStorage
.
setItem
(
'tableColumnShowSetting'
,
JSON
.
stringify
(
obj
));
}
// 获取采集项表单API(用于采集方案页面)
const
collectionItemFormApi
=
inject
(
'collectionItemFormApi'
,
null
);
function
customClick
(
executeButton
,
record
?,
index
?)
{
curRecord
.
value
=
index
;
curButtonModalConfig
.
value
=
executeButton
.
modal
;
// 特殊处理:如果是选择采集项按钮,直接调用provide的方法
if
(
executeButton
.
key
===
'selectCollectionItem'
&&
collectionItemFormApi
)
{
if
(
collectionItemFormApi
.
openCollectionItemSelect
)
{
collectionItemFormApi
.
openCollectionItemSelect
();
}
return
;
}
let
obj
=
{
selectedRows
:
selectedRowsData
.
value
,
tableDatas
:
data
.
value
,
...
...
xjrsoft-vue3/src/views/jcsj/cjfa/components/CollectionItemSelectModal.vue
deleted
100644 → 0
View file @
c4924f07
<
template
>
<BasicModal
v-bind=
"$attrs"
@
register=
"registerModal"
title=
"选择采集项"
width=
"800"
@
ok=
"handleSubmit"
@
cancel=
"handleCancel"
:destroyOnClose=
"true"
>
<BasicTable
@
register=
"registerTable"
/>
</BasicModal>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
nextTick
}
from
'vue'
;
import
{
BasicModal
,
useModalInner
}
from
'/@/components/Modal'
;
import
{
BasicTable
,
useTable
}
from
'/@/components/Table'
;
import
{
getMesCollectionItemPage
}
from
'/@/api/jcsj/cjx'
;
import
{
columns
}
from
'./collectionItemColumns'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
const
emit
=
defineEmits
([
'success'
]);
const
{
createMessage
}
=
useMessage
();
const
contentType
=
ref
<
string
>
(
''
);
const
getExistingItemIds
=
ref
<
(()
=>
string
[])
|
null
>
(
null
);
// 获取已存在的采集项ID列表的函数
// 表格配置:不再维护外部 selection 状态
const
[
registerTable
,
{
reload
,
clearSelectedRowKeys
,
getSelectRows
,
getDataSource
,
setTableData
}]
=
useTable
({
title
:
'采集项列表'
,
rowSelection
:
{
type
:
'checkbox'
,
},
api
:
async
(
params
)
=>
{
if
(
!
contentType
.
value
)
{
createMessage
.
warning
(
'请先选择采集内容'
);
return
{
list
:
[],
total
:
0
};
}
const
ctParam
=
String
(
contentType
.
value
||
''
);
if
(
!
ctParam
)
return
{
list
:
[],
total
:
0
};
const
queryParams
=
{
...
params
,
contentType
:
ctParam
,
size
:
Math
.
min
(
params
.
pageSize
||
50
,
100
),
};
try
{
const
result
=
await
getMesCollectionItemPage
(
queryParams
);
// 兼容多种返回格式
if
(
Array
.
isArray
(
result
))
{
return
{
list
:
result
,
total
:
result
.
length
};
}
if
(
result
?.
list
)
{
return
{
list
:
result
.
list
,
total
:
result
.
total
??
result
.
list
.
length
};
}
if
(
result
?.
records
)
{
return
{
list
:
result
.
records
,
total
:
result
.
total
??
result
.
records
.
length
};
}
// 泛型兼容:找第一个数组字段
for
(
const
key
in
result
)
{
if
(
Array
.
isArray
(
result
[
key
]))
{
return
{
list
:
result
[
key
],
total
:
result
.
total
??
result
[
key
].
length
};
}
}
}
catch
(
error
:
any
)
{
console
.
error
(
'获取采集项失败:'
,
error
);
createMessage
.
error
(
error
?.
message
||
'请求失败'
);
}
return
{
list
:
[],
total
:
0
};
},
columns
,
pagination
:
{
pageSize
:
50
},
rowKey
:
'id'
,
canResize
:
false
,
showIndexColumn
:
false
,
useSearchForm
:
false
,
});
// 弹窗注册
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
// 先重置所有状态,确保按钮可用
setModalProps
({
confirmLoading
:
false
,
destroyOnClose
:
true
,
});
// 提取 contentType
let
ctValue
=
data
?.
contentType
;
if
(
Array
.
isArray
(
ctValue
))
ctValue
=
ctValue
[
0
];
contentType
.
value
=
ctValue
?
String
(
ctValue
)
:
''
;
// 保存获取已存在采集项ID列表的函数
getExistingItemIds
.
value
=
typeof
data
?.
getExistingItemIds
===
'function'
?
data
.
getExistingItemIds
:
null
;
if
(
!
contentType
.
value
)
{
createMessage
.
warning
(
'请先选择采集内容'
);
closeModal
();
return
;
}
// 等待 DOM 更新
await
nextTick
();
// 清除可能遗留的选中状态和数据
if
(
clearSelectedRowKeys
)
{
clearSelectedRowKeys
();
}
if
(
setTableData
)
{
setTableData
([]);
}
// 重新加载对应类型的数据
await
reload
();
// 再次确保选中已清空
await
nextTick
();
if
(
clearSelectedRowKeys
)
{
clearSelectedRowKeys
();
}
// 确保按钮状态正确
setModalProps
({
confirmLoading
:
false
,
});
});
// 提交处理:直接从表格获取选中行
async
function
handleSubmit
()
{
try
{
// 设置加载状态,防止重复点击
setModalProps
({
confirmLoading
:
true
});
const
selectedRows
=
getSelectRows
();
console
.
log
(
'handleSubmit - selectedRows:'
,
selectedRows
);
if
(
!
selectedRows
||
selectedRows
.
length
===
0
)
{
createMessage
.
warning
(
'请至少选择一个采集项'
);
setModalProps
({
confirmLoading
:
false
});
return
;
}
// 在提交时实时获取最新的采集项列表,检查是否重复
let
currentExistingItemIds
:
string
[]
=
[];
if
(
getExistingItemIds
.
value
)
{
try
{
const
ids
=
getExistingItemIds
.
value
();
currentExistingItemIds
=
Array
.
isArray
(
ids
)
?
ids
.
map
(
id
=>
String
(
id
)).
filter
(
Boolean
)
:
[];
}
catch
(
error
)
{
console
.
error
(
'获取已存在的采集项列表失败:'
,
error
);
}
}
// 检查是否与已存在的采集项重复
const
duplicateItems
:
any
[]
=
[];
selectedRows
.
forEach
((
item
:
any
)
=>
{
const
itemId
=
String
(
item
.
id
||
''
);
if
(
currentExistingItemIds
.
includes
(
itemId
))
{
duplicateItems
.
push
(
item
);
}
});
if
(
duplicateItems
.
length
>
0
)
{
const
names
=
duplicateItems
.
map
(
item
=>
item
.
name
||
item
.
code
||
item
.
id
).
join
(
'、'
);
createMessage
.
warning
(
`以下采集项已存在,不可重复选择:
${
names
}
`
);
setModalProps
({
confirmLoading
:
false
});
return
;
}
// 触发成功事件
emit
(
'success'
,
selectedRows
);
// 重置加载状态
setModalProps
({
confirmLoading
:
false
});
// 清空所有数据和状态(这些操作即使失败也不应该影响成功流程)
try
{
if
(
clearSelectedRowKeys
)
{
clearSelectedRowKeys
();
}
if
(
setTableData
)
{
setTableData
([]);
}
}
catch
(
cleanupError
)
{
console
.
warn
(
'清空数据时出错(不影响提交):'
,
cleanupError
);
}
// 使用 nextTick 确保状态更新后再关闭
await
nextTick
();
closeModal
();
}
catch
(
error
)
{
console
.
error
(
'提交失败:'
,
error
);
createMessage
.
error
(
'提交失败,请重试'
);
setModalProps
({
confirmLoading
:
false
});
}
}
// 取消处理
function
handleCancel
()
{
// 确保按钮状态正确
setModalProps
({
confirmLoading
:
false
});
// 清空所有数据和状态
if
(
clearSelectedRowKeys
)
{
clearSelectedRowKeys
();
}
if
(
setTableData
)
{
setTableData
([]);
}
closeModal
();
}
</
script
>
xjrsoft-vue3/src/views/jcsj/cjfa/components/Form.vue
View file @
26c03b64
This diff is collapsed.
Click to expand it.
xjrsoft-vue3/src/views/jcsj/cjfa/components/SelectCollectionItemModal.vue
0 → 100644
View file @
26c03b64
<
template
>
<BasicModal
v-bind=
"$attrs"
@
register=
"registerModal"
title=
"选择采集项"
@
ok=
"handleSubmit"
@
visible-change=
"handleVisibleChange"
@
cancel=
"handleCancel"
width=
"800px"
:height=
"600"
>
<BasicTable
@
register=
"registerTable"
/>
</BasicModal>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ref
}
from
'vue'
;
import
{
BasicModal
,
useModalInner
}
from
'/@/components/Modal'
;
import
{
BasicTable
,
useTable
}
from
'/@/components/Table'
;
import
{
FormSchema
}
from
'/@/components/Form'
;
import
{
BasicColumn
}
from
'/@/components/Table'
;
import
{
getMesCollectionItemPage
}
from
'/@/api/jcsj/cjx'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
const
{
t
}
=
useI18n
();
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
contentType
=
ref
<
string
>
(
''
);
const
searchFormSchema
:
FormSchema
[]
=
[
{
field
:
'code'
,
label
:
'编码'
,
component
:
'Input'
,
colProps
:
{
span
:
8
},
},
{
field
:
'name'
,
label
:
'名称'
,
component
:
'Input'
,
colProps
:
{
span
:
8
},
},
];
const
columns
:
BasicColumn
[]
=
[
{
title
:
'编码'
,
dataIndex
:
'code'
,
width
:
150
,
},
{
title
:
'名称'
,
dataIndex
:
'name'
,
width
:
200
,
},
{
title
:
'采集内容'
,
dataIndex
:
'contentType'
,
width
:
150
,
},
{
title
:
'备注'
,
dataIndex
:
'note'
,
width
:
200
,
},
];
const
[
registerTable
,
{
getSelectRows
,
reload
,
clearSelectedRowKeys
,
getForm
}]
=
useTable
({
title
:
'采集项列表'
,
api
:
getMesCollectionItemPage
,
rowKey
:
'id'
,
columns
,
formConfig
:
{
labelWidth
:
70
,
schemas
:
searchFormSchema
,
},
rowSelection
:
{
type
:
'checkbox'
,
},
useSearchForm
:
true
,
showTableSetting
:
false
,
bordered
:
true
,
pagination
:
{
pageSize
:
10
,
},
beforeFetch
:
(
params
)
=>
{
// 根据选择的采集内容过滤
if
(
contentType
.
value
)
{
params
.
contentType
=
contentType
.
value
;
}
return
params
;
},
});
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
contentType
.
value
=
data
?.
contentType
||
''
;
setModalProps
({
confirmLoading
:
false
});
await
reload
();
});
// 清空弹窗内的操作
function
clearModalOperations
()
{
// 清空表格选中项
clearSelectedRowKeys
();
// 重置搜索表单
const
form
=
getForm
();
if
(
form
)
{
form
.
resetFields
();
}
}
// 处理弹窗可见性变化
function
handleVisibleChange
(
visible
:
boolean
)
{
// 当弹窗关闭时,清空操作
if
(
!
visible
)
{
clearModalOperations
();
}
}
// 处理取消事件
function
handleCancel
()
{
clearModalOperations
();
}
const
handleSubmit
=
()
=>
{
const
selectedRows
=
getSelectRows
();
if
(
selectedRows
.
length
===
0
)
{
return
;
}
emit
(
'success'
,
selectedRows
);
closeModal
();
};
</
script
>
xjrsoft-vue3/src/views/jcsj/cjfa/components/collectionItemColumns.ts
deleted
100644 → 0
View file @
c4924f07
import
{
BasicColumn
}
from
'/@/components/Table'
;
export
const
columns
:
BasicColumn
[]
=
[
{
title
:
'编码'
,
dataIndex
:
'code'
,
width
:
150
,
},
{
title
:
'名称'
,
dataIndex
:
'name'
,
width
:
200
,
},
{
title
:
'数据类型'
,
dataIndex
:
'dataType'
,
width
:
120
,
},
{
title
:
'备注'
,
dataIndex
:
'note'
,
width
:
200
,
},
];
xjrsoft-vue3/src/views/jcsj/cjfa/components/config.ts
View file @
26c03b64
...
...
@@ -409,7 +409,7 @@ export const formProps: FormProps = {
suffix
:
''
,
addonBefore
:
''
,
addonAfter
:
''
,
disabled
:
(
record
:
any
)
=>
record
?.
_isFromSelect
===
true
,
disabled
:
true
,
allowClear
:
false
,
showLabel
:
true
,
required
:
false
,
...
...
@@ -440,7 +440,7 @@ export const formProps: FormProps = {
suffix
:
''
,
addonBefore
:
''
,
addonAfter
:
''
,
disabled
:
(
record
:
any
)
=>
record
?.
_isFromSelect
===
true
,
disabled
:
true
,
allowClear
:
false
,
showLabel
:
true
,
required
:
false
,
...
...
@@ -468,7 +468,7 @@ export const formProps: FormProps = {
showSearch
:
false
,
isMultiple
:
false
,
clearable
:
false
,
disabled
:
(
record
:
any
)
=>
record
?.
_isFromSelect
===
true
,
disabled
:
true
,
staticOptions
:
[
{
key
:
1
,
label
:
'Option 1'
,
value
:
'Option 1'
},
{
key
:
2
,
label
:
'Option 2'
,
value
:
'Option 2'
},
...
...
@@ -510,7 +510,7 @@ export const formProps: FormProps = {
suffix
:
''
,
addonBefore
:
''
,
addonAfter
:
''
,
disabled
:
(
record
:
any
)
=>
record
?.
_isFromSelect
===
true
,
disabled
:
true
,
allowClear
:
false
,
showLabel
:
true
,
required
:
false
,
...
...
@@ -567,7 +567,7 @@ export const formProps: FormProps = {
buttonName
:
'选择数据'
,
showLabel
:
true
,
showComponentBorder
:
true
,
showBorder
:
tru
e
,
showBorder
:
fals
e
,
bordercolor
:
'#f0f0f0'
,
bordershowtype
:
[
true
,
true
,
true
,
true
],
borderwidth
:
1
,
...
...
@@ -603,20 +603,12 @@ export const formProps: FormProps = {
checked
:
false
,
},
],
isShowAdd
:
fals
e
,
isShowAdd
:
tru
e
,
isShowDelete
:
true
,
hasCheckedCol
:
true
,
events
:
{},
showPagenation
:
true
,
showColunmSet
:
false
,
topButtonList
:
[
{
key
:
'selectCollectionItem'
,
label
:
'新增'
,
style
:
'primary'
,
icon
:
'ant-design:plus-outlined'
,
},
],
},
},
],
...
...
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