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
d5337983
Commit
d5337983
authored
Jan 16, 2023
by
TZW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
116保养
parent
d47a343e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
506 additions
and
36 deletions
+506
-36
index.jsx
src/components/InitForm/Diyrule/index.jsx
+4
-6
procolumns.js
src/pages/maintain/criterion/procolumns.js
+1
-0
columns.js
src/pages/maintain/plan/columns.js
+212
-3
index.jsx
src/pages/maintain/plan/index.jsx
+289
-27
No files found.
src/components/InitForm/Diyrule/index.jsx
View file @
d5337983
...
...
@@ -518,12 +518,10 @@ let Diyrule = (props) => {
<
p
style=
{
{
color
:
'#999'
,
marginBottom
:
24
}
}
>
放置在第几个之后
</
p
>
<
Select
value=
{
other
?.
sort
}
options=
{
Object
.
keys
(
Array
.
apply
(
null
,
{
length
:
value
?
value
.
length
:
0
})).
map
(
(
it
,
i
)
=>
({
label
:
`第${i + 1}个`
,
value
:
i
+
1
,
}),
)
}
options=
{
Array
.
apply
(
null
,
{
length
:
value
?
value
.
length
:
0
}).
map
((
it
,
i
)
=>
({
label
:
`第${i + 1}个`
,
value
:
i
+
2
,
}))
}
onChange=
{
(
val
)
=>
{
onChange
({
value
:
value
,
...
...
src/pages/maintain/criterion/procolumns.js
View file @
d5337983
...
...
@@ -71,6 +71,7 @@ function procolumns(id) {
key
:
'estimateWorkingHours'
,
valueType
:
'digit'
,
hideInSearch
:
true
,
precision
:
0
,
},
{
title
:
'备注'
,
...
...
src/pages/maintain/plan/columns.js
View file @
d5337983
import
dayjs
from
'dayjs'
;
function
getcolumns
(
setdrawer
)
{
const
disabledDateOfDay
=
(
current
)
=>
{
// Can not select days before today and today
return
current
&&
current
<
dayjs
().
endOf
(
'day'
);
};
const
disabledDateOfMonth
=
(
current
)
=>
{
// Can not select days before today and today
return
current
&&
current
<
dayjs
().
startOf
(
'month'
);
};
const
columns_day
=
[
{
title
:
'设备编号'
,
dataIndex
:
'equipmentNo'
,
key
:
'equipmentNo'
,
editable
:
false
,
},
{
title
:
'设备名称'
,
dataIndex
:
'equipmentName'
,
key
:
'equipmentName'
,
editable
:
false
,
},
{
title
:
'工厂名称'
,
dataIndex
:
'factoryName'
,
key
:
'factoryId'
,
hideInForm
:
true
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
},
options
:
{
path
:
'/auth/sysFactory/getAllFactorySelection'
,
params
:
{},
},
editable
:
false
,
},
{
title
:
'车间名称'
,
dataIndex
:
'shopName'
,
key
:
'shopId'
,
hideInForm
:
true
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
},
options
:
{
path
:
'/auth/sysShop/getAllShopSelection'
,
params
:
{},
},
editable
:
false
,
},
{
title
:
'下次保养日期'
,
dataIndex
:
'nextMaintainDate'
,
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
fieldProps
:
{
disabledDate
:
disabledDateOfDay
,
},
valueType
:
'date'
,
hideInSearch
:
true
,
},
];
const
columns_month
=
[
{
title
:
'设备编号'
,
dataIndex
:
'equipmentNo'
,
key
:
'equipmentNo'
,
editable
:
false
,
},
{
title
:
'设备名称'
,
dataIndex
:
'equipmentName'
,
key
:
'equipmentName'
,
editable
:
false
,
},
{
title
:
'工厂名称'
,
dataIndex
:
'factoryName'
,
key
:
'factoryId'
,
hideInForm
:
true
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
},
options
:
{
path
:
'/auth/sysFactory/getAllFactorySelection'
,
params
:
{},
},
editable
:
false
,
},
{
title
:
'车间名称'
,
dataIndex
:
'shopName'
,
key
:
'shopId'
,
hideInForm
:
true
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
},
options
:
{
path
:
'/auth/sysShop/getAllShopSelection'
,
params
:
{},
},
editable
:
false
,
},
{
title
:
'下次保养日期'
,
dataIndex
:
'nextMaintainDate'
,
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
fieldProps
:
{
disabledDate
:
disabledDateOfMonth
,
},
valueType
:
'dateMonth'
,
hideInSearch
:
true
,
},
];
return
[
{
tab
:
'未完成'
,
...
...
@@ -9,6 +145,23 @@ function getcolumns(setdrawer) {
dataIndex
:
'maintainNo'
,
key
:
'maintainNo'
,
hideInForm
:
true
,
render
:
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
a
onClick
=
{()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
val
:
'detail'
,
title
:
'详细信息'
,
item
:
row
,
}));
}}
>
{
row
?.
maintainNo
}
<
/a
>
);
},
},
{
title
:
'设备编号'
,
...
...
@@ -126,7 +279,7 @@ function getcolumns(setdrawer) {
value
:
'1'
,
},
{
label
:
'
循环
'
,
label
:
'
周期
'
,
value
:
'2'
,
},
],
...
...
@@ -140,7 +293,7 @@ function getcolumns(setdrawer) {
],
},
render
:
(
_
,
row
)
=>
{
return
row
?.
isCycle
==
1
?
'单次'
:
'
循环
'
;
return
row
?.
isCycle
==
1
?
'单次'
:
'
周期
'
;
},
},
{
...
...
@@ -148,6 +301,7 @@ function getcolumns(setdrawer) {
dataIndex
:
'nextMaintainDate'
,
key
:
'nextMaintainDateList'
,
valueType
:
'dateRange'
,
hideInForm
:
true
,
},
{
title
:
'状态'
,
...
...
@@ -155,6 +309,9 @@ function getcolumns(setdrawer) {
key
:
'maintainStatus'
,
hideInForm
:
true
,
valueType
:
'select'
,
fieldProps
:
{
dropdownMatchSelectWidth
:
100
,
},
mode
:
'radio'
,
options
:
[
{
...
...
@@ -167,6 +324,58 @@ function getcolumns(setdrawer) {
},
],
},
{
title
:
'选择设备'
,
dataIndex
:
'paramList'
,
key
:
'paramList'
,
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
hideInSearch
:
true
,
hideInTable
:
true
,
hideInForm
:
{
maintainFrequency
:
{
reverse
:
[
'0'
],
},
},
valueType
:
'formSelectList'
,
colProps
:
{
span
:
24
,
},
path
:
'/asset/equipment/list/user/shop'
,
columns
:
columns_day
,
hideInDescriptions
:
true
,
},
{
title
:
'选择设备'
,
dataIndex
:
'paramList'
,
key
:
'paramList'
,
hideInForm
:
{
maintainFrequency
:
[
'0'
],
},
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
hideInSearch
:
true
,
hideInTable
:
true
,
valueType
:
'formSelectList'
,
colProps
:
{
span
:
24
,
},
path
:
'/asset/equipment/list/user/shop'
,
columns
:
columns_month
,
hideInDescriptions
:
true
,
},
],
pathconfig
:
{
enableadd
:
true
,
...
...
@@ -300,7 +509,7 @@ function getcolumns(setdrawer) {
value
:
'1'
,
},
{
label
:
'
循环
'
,
label
:
'
周期
'
,
value
:
'2'
,
},
],
...
...
src/pages/maintain/plan/index.jsx
View file @
d5337983
/* 保养计划
* @Author: Li Hanlin
* @Date: 2023-01-16 15:35:00
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-01-16 17:33:58
*/
import
*
as
React
from
'react'
;
import
{
useState
,
useMemo
,
useRef
}
from
'react'
;
import
{
Switch
,
Popconfirm
}
from
'antd'
;
import
DrawerPro
from
'@/components/DrawerPro'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
AutoTables
from
'@/components/AutoTable/mtable'
;
import
PremButton
from
'@/components/PremButton'
;
import
getcolumns
from
'./columns'
;
import
{
useRequest
}
from
'ahooks'
;
import
dayjs
from
'dayjs'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
InitForm
from
'@/components/InitForm'
;
function
Plan
(
props
)
{
const
actionRef
=
useRef
(),
formRef
=
useRef
();
...
...
@@ -15,7 +25,7 @@ function Plan(props) {
}),
[
activeTabKey
,
setactiveTabKey
]
=
useState
(
'1'
);
const
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
const
{
run
,
loading
,
runAsync
}
=
useRequest
(
doFetch
,
{
manual
:
true
,
onSuccess
:
(
res
,
params
)
=>
{
if
(
res
?.
code
==
'0000'
)
{
...
...
@@ -28,6 +38,139 @@ function Plan(props) {
},
});
const
editDateColumns
=
useMemo
(()
=>
{
const
disabledDateOfDay
=
(
current
)
=>
{
// Can not select days before today and today
return
current
&&
current
<
dayjs
().
endOf
(
'day'
);
};
const
disabledDateOfMonth
=
(
current
)
=>
{
// Can not select days before today and today
return
current
&&
current
<
dayjs
().
startOf
(
'month'
);
};
const
disabledDate
=
(
current
)
=>
{
if
(
drawer
?.
item
?.
status
==
1
)
{
return
current
&&
current
<
dayjs
().
endOf
(
'day'
);
}
else
{
if
(
dayjs
(
drawer
?.
item
?.
planCheckDate
).
endOf
(
'day'
).
valueOf
()
>=
dayjs
().
endOf
(
'day'
).
valueOf
()
)
{
return
current
&&
current
<=
dayjs
(
drawer
?.
item
?.
planCheckDate
).
endOf
(
'day'
);
}
else
{
return
current
&&
current
<
dayjs
().
endOf
(
'day'
);
}
}
};
return
[
{
title
:
'保养频次'
,
dataIndex
:
'maintainFrequencyName'
,
key
:
'maintainFrequency'
,
fieldProps
:
{
disabled
:
true
,
},
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
valueType
:
'select'
,
mode
:
'radio'
,
options
:
[
{
label
:
'周'
,
value
:
0
,
},
{
label
:
'月度'
,
value
:
1
,
},
{
label
:
'季度'
,
value
:
2
,
},
{
label
:
'半年'
,
value
:
3
,
},
{
label
:
'一年'
,
value
:
4
,
},
],
},
{
title
:
'计划类型'
,
dataIndex
:
'isCycle'
,
key
:
'isCycle'
,
fieldProps
:
{
disabled
:
true
,
},
valueType
:
'select'
,
mode
:
'radio'
,
options
:
[
{
label
:
'单次'
,
value
:
1
,
},
{
label
:
'周期'
,
value
:
2
,
},
],
},
{
title
:
'下次保养日期'
,
dataIndex
:
'nextMaintainDate'
,
key
:
'nextMaintainDate'
,
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
fieldProps
:
{
disabledDate
:
disabledDateOfDay
,
},
valueType
:
'date'
,
hideInSearch
:
true
,
hideInDescriptions
:
true
,
hideInForm
:
{
maintainFrequency
:
{
reverse
:
[
0
],
},
},
},
{
title
:
'下次保养日期'
,
dataIndex
:
'nextMaintainDate'
,
key
:
'nextMaintainDate'
,
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
fieldProps
:
{
disabledDate
:
disabledDateOfMonth
,
},
valueType
:
'dateMonth'
,
hideInForm
:
{
maintainFrequency
:
[
0
],
},
hideInSearch
:
true
,
hideInDescriptions
:
true
,
},
];
},
[
drawer
?.
item
]);
const
detail
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
...
...
@@ -51,23 +194,23 @@ function Plan(props) {
);
};
const
edit
=
(
text
,
row
,
_
,
action
)
=>
{
const
close
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
pop=
{
{
title
:
'是否关单?'
,
okText
:
'确认'
,
cancelText
:
'取消'
,
onConfirm
:
async
()
=>
{
await
runAsync
({
url
:
'/check/umEquipmentCheckPlan/shut'
,
params
:
{
id
:
row
?.
id
}
});
},
}
}
btn=
{
{
size
:
'small'
,
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
row
,
title
:
'编辑'
,
val
:
'edit'
,
}));
},
type
:
'danger'
,
}
}
>
编辑
关单
</
PremButton
>
);
};
...
...
@@ -93,19 +236,104 @@ function Plan(props) {
);
};
const
editDate
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
btn=
{
{
size
:
'small'
,
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
row
,
title
:
'调整日期'
,
val
:
'detailaddon'
,
id
:
row
?.
id
,
}));
},
}
}
>
调整日期
</
PremButton
>
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setdrawer
).
filter
((
it
)
=>
it
.
key
==
activeTabKey
)[
0
]?.
columns
;
let
defpath
=
getcolumns
(
setdrawer
).
filter
((
it
)
=>
it
.
key
==
activeTabKey
)[
0
]?.
pathconfig
??
{};
return
defcolumn
.
concat
({
title
:
'操作'
,
valueType
:
'option'
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
[
defpath
?.
enabledetail
&&
detail
(
text
,
row
,
_
,
action
),
defpath
?.
enableedit
&&
edit
(
text
,
row
,
_
,
action
),
defpath
?.
enabledelete
&&
remove
(
text
,
row
,
_
,
action
),
],
});
return
activeTabKey
==
1
?
defcolumn
.
concat
([
{
title
:
'启用/停用'
,
dataIndex
:
'isStopStatus'
,
key
:
'isStopStatus'
,
hideInForm
:
true
,
hideInSearch
:
true
,
valueType
:
'switch'
,
render
:
(
text
,
row
,
_
,
action
)
=>
{
//"1停用 2启用 *"
return
row
.
isStopStatus
==
1
?
(
<
Popconfirm
title=
"是否开启或停用?"
onConfirm=
{
async
()
=>
{
if
(
row
.
checkEnable
==
1
)
{
await
runAsync
({
url
:
'/check/umEquipmentCheckPlan/enable'
,
params
:
{
id
:
row
.
id
,
checkEnable
:
2
},
});
}
}
}
okText=
"确定"
cancelText=
"取消"
disabled=
{
!
(
row
.
status
==
1
||
(
row
.
status
==
2
&&
row
.
checkLoop
==
2
))
}
>
<
Switch
checked=
{
row
.
checkEnable
==
1
?
true
:
false
}
checkedChildren=
"开启"
unCheckedChildren=
"停用"
defaultChecked=
{
false
}
disabled=
{
!
(
row
.
status
==
1
||
(
row
.
status
==
2
&&
row
.
checkLoop
==
2
))
}
/>
</
Popconfirm
>
)
:
(
<
Switch
checked=
{
row
.
isStopStatus
==
1
?
true
:
false
}
checkedChildren=
"开启"
unCheckedChildren=
"停用"
defaultChecked=
{
false
}
disabled=
{
!
(
row
.
maintainStatus
==
1
||
(
row
.
maintainStatus
==
2
&&
row
.
isCycle
==
2
))
}
onChange=
{
(
checked
)
=>
{
if
(
checked
)
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
row
,
title
:
'调整日期'
,
val
:
'detailaddon'
,
id
:
row
?.
id
,
}));
}
}
}
/>
);
},
hideInDescriptions
:
true
,
},
{
title
:
'操作'
,
valueType
:
'option'
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
[
(
row
.
maintainStatus
==
1
||
(
row
.
maintainStatus
==
2
&&
row
.
isCycle
==
2
))
&&
editDate
(
text
,
row
,
_
,
action
),
row
.
maintainStatus
==
2
&&
close
(
text
,
row
,
_
,
action
),
defpath
?.
enabledelete
&&
row
.
maintainStatus
==
1
&&
remove
(
text
,
row
,
_
,
action
),
],
},
])
:
defcolumn
;
},
[
activeTabKey
]);
const
pathconfig
=
useMemo
(()
=>
{
...
...
@@ -159,14 +387,48 @@ function Plan(props) {
}));
}
}
{
...
drawer
}
onFinish=
{
(
vals
)
=>
{
onFinish=
{
async
(
vals
)
=>
{
console
.
log
(
vals
);
let
params
=
JSON
.
parse
(
JSON
.
stringify
(
vals
));
params
.
equipmentList
=
vals
?.
paramList
?.
map
((
it
)
=>
{
return
{
id
:
it
.
id
,
nextMaintainDate
:
it
.
nextMaintainDate
,
};
});
delete
params
.
paramList
;
let
flag
=
params
.
equipmentList
?.
some
((
it
)
=>
!
it
.
nextMaintainDate
);
if
(
flag
)
{
message
.
warning
(
'下次点检日期必填!'
);
return
;
}
console
.
log
(
params
);
if
(
drawer
?.
val
==
'add'
)
{
run
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
val
s
}
});
await
runAsync
({
url
:
pathconfig
?.
add
||
'/add'
,
params
:
{
...
param
s
}
});
}
else
if
(
drawer
?.
val
==
'edit'
)
{
run
({
url
:
pathconfig
?.
edit
||
'/edit'
,
params
:
{
...
vals
,
id
:
drawer
?.
item
?.
id
}
});
await
runAsync
({
url
:
pathconfig
?.
edit
||
'/edit'
,
params
:
{
...
params
,
id
:
drawer
?.
item
?.
id
},
});
}
}
}
/>
>
<
InitForm
fields=
{
editDateColumns
}
defaultFormValue=
{
{
isCycle
:
drawer
?.
item
?.
isCycle
,
maintainFrequency
:
drawer
?.
item
?.
maintainFrequency
,
}
}
onFinish=
{
async
(
vals
)
=>
{
delete
vals
.
isCycle
;
delete
vals
.
maintainFrequency
;
await
runAsync
({
url
:
'/maintain/umMaintainPlan/enableDeactivate'
,
params
:
{
...
vals
,
id
:
drawer
?.
item
?.
id
},
});
}
}
/>
</
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