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
e6d5d4c9
Commit
e6d5d4c9
authored
Dec 29, 2025
by
史雅文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仓库位置列表添加树形结构
parent
1c1c92f0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
27 deletions
+76
-27
xjrsoft-vue3/src/api/jcsj/ckwz/index.ts
+15
-3
xjrsoft-vue3/src/views/jcsj/ckwz/index.vue
+61
-24
No files found.
xjrsoft-vue3/src/api/jcsj/ckwz/index.ts
View file @
e6d5d4c9
...
@@ -8,9 +8,7 @@ enum Api {
...
@@ -8,9 +8,7 @@ enum Api {
List
=
'/jcsj/ckwz/list'
,
List
=
'/jcsj/ckwz/list'
,
Info
=
'/jcsj/ckwz/info'
,
Info
=
'/jcsj/ckwz/info'
,
RokeStockLocation
=
'/jcsj/ckwz'
,
RokeStockLocation
=
'/jcsj/ckwz'
,
Tree
=
'/jcsj/ckwz/tree'
,
}
}
/**
/**
...
@@ -88,6 +86,20 @@ export async function deleteRokeStockLocation(ids: string[], mode: ErrorMessageM
...
@@ -88,6 +86,20 @@ export async function deleteRokeStockLocation(ids: string[], mode: ErrorMessageM
);
);
}
}
/**
* @description: 获取位置树数据
*/
export
async
function
getRokeStockLocationTree
(
mode
:
ErrorMessageMode
=
'modal'
)
{
return
defHttp
.
get
<
any
>
(
{
url
:
Api
.
Tree
,
},
{
errorMessageMode
:
mode
,
},
);
}
xjrsoft-vue3/src/views/jcsj/ckwz/index.vue
View file @
e6d5d4c9
<
template
>
<
template
>
<PageWrapper
dense
fixedHeight
contentFullHeight
contentClass=
"flex"
>
<div
class=
"w-1/5 xl:w-1/5 mr-2"
>
<ResizePageWrapper
:hasLeft=
"false"
>
<BasicTree
title=
"上级位置"
toolbar
<template
#
resizeRight
>
search
<BasicTable
@
register=
"registerTable"
isMenuTable
ref=
"tableRef"
:defaultExpandAll=
"true"
:clickRowToExpand=
"true"
:treeData=
"treeData"
:fieldNames=
"
{ key: 'id', title: 'name' }"
@select="handleSelect"
>
>
<template
#
title=
"item"
>
{{
item
.
name
}}
</
template
>
</BasicTree>
</div>
<div
class=
"w-4/5 xl:w-4/5"
>
<BasicTable
@
register=
"registerTable"
isMenuTable
ref=
"tableRef"
>
<
template
#
toolbar
>
<
template
#
toolbar
>
<template
v-for=
"button in tableButtonConfig"
:key=
"button.code"
>
<template
v-for=
"button in tableButtonConfig"
:key=
"button.code"
>
...
@@ -45,29 +53,22 @@
...
@@ -45,29 +53,22 @@
</BasicTable>
</BasicTable>
</template>
</div>
<CkwzModal
@
register=
"registerModal"
@
success=
"handleFormSuccess"
@
cancel=
"handleFormCancel"
/>
</PageWrapper>
<CkwzModal
@
register=
"registerModal"
@
success=
"handleFormSuccess"
@
cancel=
"handleFormCancel"
/>
</ResizePageWrapper>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
computed
,
provide
,
Ref
,
createVNode
,
import
{
ref
,
computed
,
provide
,
Ref
,
createVNode
,
onMounted
}
from
'vue'
;
}
from
'vue'
;
import
{
Modal
}
from
'ant-design-vue'
;
import
{
Modal
}
from
'ant-design-vue'
;
import
{
ExclamationCircleOutlined
}
from
'@ant-design/icons-vue'
;
import
{
ExclamationCircleOutlined
}
from
'@ant-design/icons-vue'
;
import
{
BasicTable
,
useTable
,
TableAction
,
ActionItem
}
from
'/@/components/Table'
;
import
{
BasicTable
,
useTable
,
TableAction
,
ActionItem
}
from
'/@/components/Table'
;
import
{
getRokeStockLocationPage
,
deleteRokeStockLocation
}
from
'/@/api/jcsj/ckwz'
;
import
{
getRokeStockLocationPage
,
deleteRokeStockLocation
,
getRokeStockLocationTree
}
from
'/@/api/jcsj/ckwz'
;
import
{
ResizePageWrapper
}
from
'/@/components/Page'
;
import
{
PageWrapper
}
from
'/@/components/Page'
;
import
{
BasicTree
,
TreeItem
}
from
'/@/components/Tree'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
import
{
useMessage
}
from
'/@/hooks/web/useMessage'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
import
{
usePermission
}
from
'/@/hooks/web/usePermission'
;
...
@@ -117,6 +118,10 @@
...
@@ -117,6 +118,10 @@
const
{
enableLockeData
,
handleOpenFormEnableLockeData
,
handleCloseFormEnableLocke
,
handleHasEnableLocke
}
=
const
{
enableLockeData
,
handleOpenFormEnableLockeData
,
handleCloseFormEnableLocke
,
handleHasEnableLocke
}
=
useConcurrentLock
();
useConcurrentLock
();
// 树相关
const
treeData
=
ref
<
TreeItem
[]
>
([]);
const
selectedParentId
=
ref
<
string
>
(
''
);
const
{
notification
}
=
useMessage
();
const
{
notification
}
=
useMessage
();
const
{
t
}
=
useI18n
();
const
{
t
}
=
useI18n
();
defineEmits
([
'register'
]);
defineEmits
([
'register'
]);
...
@@ -181,7 +186,12 @@
...
@@ -181,7 +186,12 @@
},
},
bordered
:
false
,
bordered
:
false
,
beforeFetch
:
(
params
)
=>
{
beforeFetch
:
(
params
)
=>
{
pageParamsInfo
.
value
=
{...
params
,
FormId
:
formIdComputedRef
.
value
,
PK
:
'id'
}
pageParamsInfo
.
value
=
{
...
params
,
FormId
:
formIdComputedRef
.
value
,
PK
:
'id'
,
parentId
:
selectedParentId
.
value
||
undefined
,
};
return
pageParamsInfo
.
value
;
return
pageParamsInfo
.
value
;
},
},
afterFetch
:
(
res
)
=>
{
afterFetch
:
(
res
)
=>
{
...
@@ -298,11 +308,38 @@
...
@@ -298,11 +308,38 @@
}
}
function
handleSuccess
()
{
function
handleSuccess
()
{
reload
();
}
// 树选择处理
function
handleSelect
(
selectIds
:
string
[])
{
selectedParentId
.
value
=
selectIds
[
0
]
||
''
;
reload
();
reload
();
}
// 加载树数据
async
function
loadTreeData
()
{
try
{
const
result
=
await
getRokeStockLocationTree
();
// 处理接口返回的数据格式:{code: 0, data: [...], success: true}
// defHttp 可能会自动提取 data,但也可能需要手动处理
let
data
=
result
;
if
(
result
&&
typeof
result
===
'object'
&&
'data'
in
result
&&
Array
.
isArray
(
result
.
data
))
{
data
=
result
.
data
;
}
else
if
(
result
&&
typeof
result
===
'object'
&&
'success'
in
result
&&
result
.
data
)
{
data
=
result
.
data
;
}
if
(
Array
.
isArray
(
data
))
{
treeData
.
value
=
data
as
TreeItem
[];
}
}
catch
(
error
)
{
console
.
error
(
'加载位置树失败:'
,
error
);
}
}
}
onMounted
(()
=>
{
loadTreeData
();
});
function
handleFormSuccess
()
{
function
handleFormSuccess
()
{
...
...
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