Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
ems3.3
Commits
79c1e48d
Commit
79c1e48d
authored
Nov 18, 2022
by
TZW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1117
parent
7249b9d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
310 additions
and
8 deletions
+310
-8
index.jsx
src/components/TreeRender/index.jsx
+2
-0
columns.js
src/pages/device/account/columns.js
+2
-2
index.jsx
src/pages/device/account/index.jsx
+306
-6
No files found.
src/components/TreeRender/index.jsx
View file @
79c1e48d
...
...
@@ -295,12 +295,14 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
key
:
item
.
key
,
children
:
loop
(
item
.
children
),
level
:
item
.
level
,
type
:
item
.
type
,
};
}
return
{
title
:
noaction
?
title
:
actiontitle
,
key
:
item
.
key
,
level
:
item
.
level
,
type
:
item
.
type
,
};
});
useEffect
(()
=>
{
...
...
src/pages/device/account/columns.js
View file @
79c1e48d
...
...
@@ -209,9 +209,9 @@ function getcolumns(setdrawer) {
switch
(
row
.
status
)
{
case
1
:
return
<
Tag
color
=
"success"
>
在用
<
/Tag>
;
case
2
:
return
<
Tag
>
报废
<
/Tag>
;
case
3
:
return
<
Tag
>
报废
<
/Tag>
;
case
2
:
return
<
Tag
color
=
"volcano"
>
借用中
<
/Tag>
;
default
:
break
;
...
...
src/pages/device/account/index.jsx
View file @
79c1e48d
...
...
@@ -2,18 +2,19 @@
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-1
6 17:19:50
* @Last Modified time: 2022-11-1
7 17:25:54
*/
import
*
as
React
from
'react'
;
import
{
useState
,
useMemo
,
useRef
}
from
'react'
;
import
{
useState
,
useMemo
,
useRef
,
useEffect
}
from
'react'
;
import
DrawerPro
from
'@/components/DrawerPro'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
PremButton
from
'@/components/PremButton'
;
import
getcolumns
from
'./columns'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
message
,
Dropdown
,
Menu
,
Layout
,
Button
}
from
'antd'
;
import
{
message
,
Dropdown
,
Menu
,
Layout
,
Button
,
Space
}
from
'antd'
;
import
TreeRender
from
'@/components/TreeRender'
;
import
{
ProDescriptions
}
from
'@ant-design/pro-components'
;
const
{
Sider
,
Content
}
=
Layout
;
function
Model
(
props
)
{
...
...
@@ -30,6 +31,12 @@ function Model(props) {
detail
:
'/asset/equipment/detail'
,
};
const
urlParams_childEquipment
=
{
list
:
'/asset/equipment/children/queryList'
,
checked
:
'/asset/equipment/children/selected/queryList'
,
save
:
'/asset/equipmentChildren/save'
,
};
const
detail
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
...
...
@@ -134,10 +141,32 @@ function Model(props) {
setDrawer
((
s
)
=>
({
...
s
,
visible
:
true
,
item
:
row
,
type
:
'editChildEquipment'
,
item
:
{
id
:
row
.
id
,
},
title
:
'详情'
,
val
:
'only'
,
title
:
'编辑子设备'
,
onFinish
:
async
(
vals
)
=>
{
console
.
log
(
1
);
let
params
=
{
...
vals
,
id
:
row
.
id
,
};
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
});
if
(
res
.
code
===
'0000'
)
{
message
.
success
(
'新增成功!'
);
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
},
}));
}
}
>
...
...
@@ -173,6 +202,253 @@ function Model(props) {
);
};
const
EditChildEquipment
=
()
=>
{
const
[
selectArr
,
setSelectArr
]
=
useState
([]);
useEffect
(()
=>
{
const
fun
=
async
()
=>
{
const
result
=
await
doFetch
({
url
:
'/asset/equipment/children/selected/queryList'
,
params
:
{
id
:
drawer
?.
item
?.
id
},
});
// console.log(result);
if
(
!
result
?.
data
?.
dataList
.
length
==
0
)
{
setSelectArr
(
result
?.
data
?.
dataList
.
map
((
it
)
=>
it
.
id
));
}
};
fun
();
},
[]);
const
columns
=
[
{
title
:
'设备编号'
,
dataIndex
:
'equipmentNo'
,
key
:
'equipmentNo'
,
align
:
'center'
,
width
:
120
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
},
{
title
:
'设备名称'
,
dataIndex
:
'equipmentName'
,
align
:
'center'
,
width
:
120
,
key
:
'equipmentName'
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
},
{
title
:
'公司名称'
,
align
:
'center'
,
dataIndex
:
'organizationName'
,
width
:
120
,
key
:
'organizationId'
,
valueType
:
'select'
,
options
:
{
path
:
'/auth/sysDepartment/query/organization/selectbox'
,
params
:
{}
},
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
},
{
title
:
'部门名称'
,
width
:
120
,
align
:
'center'
,
valueType
:
'select'
,
dataIndex
:
'departmentName'
,
key
:
'departmentId'
,
options
:
{
path
:
'/auth/sysDepartment/query/depart/selectbox'
,
linkParams
:
{
organizationId
:
'parentId'
,
},
},
},
{
title
:
'工厂名称'
,
dataIndex
:
'factoryName'
,
key
:
'factoryId'
,
width
:
120
,
align
:
'center'
,
valueType
:
'select'
,
options
:
{
path
:
'/auth/sysFactory/getAllFactorySelection'
,
params
:
{}
},
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
},
{
title
:
'车间名称'
,
dataIndex
:
'shopName'
,
align
:
'center'
,
width
:
120
,
valueType
:
'select'
,
options
:
{
path
:
'/auth/sysShop/getShopSelectionByFactory'
,
linkParams
:
{
factoryId
:
''
,
},
},
key
:
'shopId'
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
},
{
title
:
'工段名称'
,
width
:
120
,
dataIndex
:
'sectionName'
,
align
:
'center'
,
key
:
'sectionId'
,
valueType
:
'select'
,
options
:
{
path
:
'/auth/sysSection/getAllSectionSelectionByShop'
,
linkParams
:
{
shopId
:
''
,
},
},
},
{
title
:
'产线名称'
,
width
:
120
,
dataIndex
:
'productLineName'
,
valueType
:
'select'
,
key
:
'productLineName'
,
align
:
'center'
,
options
:
{
path
:
'auth/sysProductionLine/getAllProductLineSelectionByShop'
,
linkParams
:
{
shopId
:
''
,
},
},
},
];
return
(
<>
<
ProDescriptions
request=
{
async
()
=>
{
const
{
data
}
=
await
doFetch
({
url
:
urlParams
.
detail
,
params
:
{
id
:
drawer
.
item
.
id
},
});
return
{
success
:
true
,
data
:
data
.
data
,
};
}
}
columns=
{
[
{
title
:
'设备编号'
,
dataIndex
:
'equipmentNo'
,
key
:
'equipmentNo'
,
},
{
title
:
'设备名称'
,
dataIndex
:
'equipmentName'
,
key
:
'equipmentName'
,
},
{
title
:
'位置号'
,
dataIndex
:
'positionNo'
,
key
:
'positionNo'
,
},
{
title
:
'公司名称'
,
dataIndex
:
'organizationName'
,
key
:
'organizationId'
,
},
{
title
:
'部门名称'
,
dataIndex
:
'departmentName'
,
key
:
'departmentId'
,
},
{
title
:
'工厂名称'
,
dataIndex
:
'factoryName'
,
key
:
'factoryId'
,
},
{
title
:
'车间名称'
,
dataIndex
:
'shopName'
,
key
:
'shopId'
,
},
{
title
:
'工段名称'
,
dataIndex
:
'sectionName'
,
key
:
'sectionId'
,
},
{
title
:
'产线名称'
,
dataIndex
:
'productLineName'
,
key
:
'productLineName'
,
},
]
}
/>
<
AutoTable
pagetitle=
"选择子设备"
columns=
{
columns
}
path=
{
urlParams_childEquipment
.
list
}
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
resizeable=
{
false
}
rowSelection=
{
{
type
:
'checkbox'
,
selectedRowKeys
:
selectArr
,
// defaultSelectedRowKeys: ,
onSelect
:
(
record
,
selected
,
selectedRows
,
nativeEvent
)
=>
{
console
.
log
(
'selectedRowKeys changed: '
,
record
,
selected
,
selectedRows
);
setSelectArr
(()
=>
{
return
selectedRows
.
map
((
it
)
=>
it
.
id
);
});
},
onSelectAll
:
(
selected
,
selectedRows
,
changeRows
)
=>
{
console
.
log
(
selected
,
selectedRows
,
changeRows
);
if
(
selected
)
{
let
arr
=
selectArr
.
concat
(
changeRows
.
map
((
it
)
=>
it
.
id
));
setSelectArr
(
arr
);
}
else
{
setSelectArr
([]);
}
},
onSelectNone
:
()
=>
{
console
.
log
(
11
);
setSelectArr
([]);
},
}
}
/>
<
Space
style=
{
{
marginTop
:
16
}
}
>
<
Button
onClick=
{
()
=>
{
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
item
:
null
,
detailpath
:
null
,
params
:
null
,
}));
setSelectArr
([]);
}
}
>
取消
</
Button
>
<
Button
type=
"primary"
onClick=
{
async
()
=>
{
console
.
log
(
selectArr
);
let
res
=
await
doFetch
({
url
:
urlParams_childEquipment
.
save
,
params
:
{
equipmentId
:
drawer
?.
item
?.
id
,
childrenIdList
:
selectArr
,
},
});
if
(
res
.
code
===
'0000'
)
{
message
.
success
(
'新增成功!'
);
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
item
:
null
,
}));
setSelectArr
([]);
actionRef
.
current
.
reload
();
}
}
}
>
提交
</
Button
>
</
Space
>
</>
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setDrawer
);
defcolumn
[
1
].
render
=
(
text
,
row
)
=>
{
...
...
@@ -208,6 +484,25 @@ function Model(props) {
});
},
[]);
const
onselecteTree
=
async
(
selectedKeys
,
e
,
alldata
)
=>
{
console
.
log
(
e
.
node
);
let
params
=
{
treeNodeType
:
e
.
node
.
type
,
treeNodeKey
:
e
.
node
.
key
,
pageSize
:
'15'
,
pageIndex
:
'1'
,
};
const
res
=
await
doFetch
({
url
:
urlParams
.
list
,
params
});
if
(
res
.
code
===
'0000'
)
{
message
.
success
(
'新增成功!'
);
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
};
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
<
div
className=
"ant-card-head"
>
...
...
@@ -219,7 +514,7 @@ function Model(props) {
</
div
>
<
Layout
style=
{
{
height
:
'100%'
}
}
>
<
Sider
theme=
"light"
width=
{
300
}
>
<
TreeRender
url=
"/auth/sysFactory/getTree"
onselected=
{
()
=>
{}
}
noaction=
{
true
}
/>
<
TreeRender
url=
"/auth/sysFactory/getTree"
onselected=
{
onselecteTree
}
noaction=
{
true
}
/>
</
Sider
>
<
Content
>
<
AutoTable
...
...
@@ -277,10 +572,15 @@ function Model(props) {
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
item
:
null
,
detailpath
:
null
,
params
:
null
,
}));
}
}
{
...
drawer
}
/>
>
{
drawer
?.
type
==
'editChildEquipment'
?
<
EditChildEquipment
/>
:
null
}
</
DrawerPro
>
</
div
>
);
}
...
...
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