Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wms
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
wms
Commits
2b7e6c2d
Commit
2b7e6c2d
authored
Aug 24, 2022
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
killder
parent
df45bb50
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2685 additions
and
2168 deletions
+2685
-2168
detail.jsx
src/components/Details/detail.jsx
+4
-4
index.jsx
src/components/DrawInitForm/index.jsx
+1
-1
index.jsx
src/components/EditTable/index.jsx
+12
-5
index.jsx
src/components/TreeRender/index.jsx
+427
-343
Index.jsx
src/pages/craft/Materiel/Index.jsx
+93
-70
fields.js
src/pages/craft/Materiel/fields.js
+6
-6
fields.js
src/pages/insertstore/Instore/fields.js
+57
-27
index.jsx
src/pages/insertstore/Instore/index.jsx
+7
-2
fields.js
src/pages/outsetstore/Outstore/fields.js
+33
-18
index.jsx
src/pages/outsetstore/Outstore/index.jsx
+530
-417
index.jsx
src/pages/platform/Custom/index.jsx
+369
-312
index.jsx
src/pages/platform/Provide/index.jsx
+378
-318
Formpage.jsx
src/pages/platform/Sendset/Formpage.jsx
+760
-638
store.js
src/pages/system/Store/store.js
+1
-6
system.js
src/services/system.js
+7
-1
No files found.
src/components/Details/detail.jsx
View file @
2b7e6c2d
src/components/DrawInitForm/index.jsx
View file @
2b7e6c2d
...
...
@@ -37,7 +37,7 @@ function DrawInitForm(props) {
placement=
"right"
closable=
{
true
}
getContainer=
{
false
}
style=
{
{
position
:
"absolute"
,
transform
:
"translateX(0)"
}
}
style=
{
{
position
:
"absolute"
,
transform
:
"translateX(0)"
,
maxWidth
:
"100%"
}
}
width=
{
props
.
val
==
"detail"
?
1000
:
props
.
width
}
destroyOnClose=
{
true
}
{
...
props
}
...
...
src/components/EditTable/index.jsx
View file @
2b7e6c2d
import
React
,
{
useEffect
,
useRef
}
from
"react"
;
import
{
EditableProTable
}
from
"@ant-design/pro-table"
;
import
ProField
from
"@ant-design/pro-field"
;
import
ProCard
from
"@ant-design/pro-card"
;
import
{
Button
}
from
"antd"
;
import
{
useUpdate
}
from
'ahooks'
;
const
EditTable
=
({
columns
,
...
...
@@ -14,7 +13,16 @@ const EditTable = ({
linkconfig
,
style
})
=>
{
const
editorFormRef
=
useRef
()
const
update
=
useUpdate
();
const
editorFormRef
=
useRef
();
useEffect
(()
=>
{
if
(
value
===
undefined
){
update
()
}
},[
value
])
console
.
log
(
columns
[
0
]);
return
(
<
EditableProTable
style=
{
{
...(
style
??
{})
}
}
...
...
@@ -40,7 +48,6 @@ const EditTable = ({
return
[
defaultDoms
.
delete
];
},
onValuesChange
:
async
(
record
,
recordList
)
=>
{
let
{
urlchangeval
}
=
linkconfig
??
{};
let
newvalue
=
[...
recordList
];
if
(
urlchangeval
&&
record
)
{
//根据url 改变 数据值
...
...
src/components/TreeRender/index.jsx
View file @
2b7e6c2d
import
React
,
{
useState
,
useMemo
,
useRef
,
createContext
}
from
'react'
;
import
{
Tree
,
Input
,
Popconfirm
,
Tooltip
,
Divider
,
Modal
,
message
}
from
'antd'
;
import
{
MinusSquareOutlined
,
FormOutlined
,
PlusSquareOutlined
,
ArrowDownOutlined
,
ArrowRightOutlined
}
from
'@ant-design/icons'
;
import
getPrem
from
'@/utils/getPrem'
;
import
{
useRequest
}
from
'ahooks'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
useEffect
}
from
'react'
;
import
Login
from
'@/pages/user/Login'
;
import
React
,
{
useState
,
useMemo
,
useRef
,
createContext
}
from
"react"
;
import
{
Tree
,
Input
,
Popconfirm
,
Tooltip
,
Divider
,
Modal
,
message
,
}
from
"antd"
;
import
{
MinusSquareOutlined
,
FormOutlined
,
PlusSquareOutlined
,
ArrowDownOutlined
,
ArrowRightOutlined
,
}
from
"@ant-design/icons"
;
import
getPrem
from
"@/utils/getPrem"
;
import
{
useRequest
}
from
"ahooks"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
useEffect
}
from
"react"
;
import
Login
from
"@/pages/user/Login"
;
const
ReachableContext
=
createContext
(
null
);
let
{
Search
}
=
Input
,
...
...
@@ -15,9 +29,11 @@ const getParentKey = (key, tree) => {
for
(
let
i
=
0
;
i
<
tree
.
length
;
i
++
)
{
const
node
=
tree
[
i
];
if
(
node
.
children
)
{
if
(
node
.
children
.
some
((
item
)
=>
{
return
item
.
key
===
key
}))
{
if
(
node
.
children
.
some
((
item
)
=>
{
return
item
.
key
===
key
;
})
)
{
parentKey
=
node
.
key
;
}
else
if
(
getParentKey
(
key
,
node
.
children
))
{
parentKey
=
getParentKey
(
key
,
node
.
children
);
...
...
@@ -27,99 +43,134 @@ const getParentKey = (key, tree) => {
return
parentKey
;
};
function
TreeRender
({
url
,
deleteurl
,
saveurl
,
onselected
,
params
,
noaction
,
maxWidth
})
{
function
TreeRender
({
url
,
deleteurl
,
saveurl
,
onselected
,
params
,
noaction
,
maxWidth
,
})
{
const
[
search
,
setsearch
]
=
useState
(
""
);
const
[
savetitle
,
setsavetitle
]
=
useState
(
null
);
const
[
modal
,
setModal
]
=
useState
({
visible
:
false
visible
:
false
,
});
const
[
expandall
,
setexpandall
]
=
useState
(
false
);
const
[
expandedKeys
,
onExpand
]
=
useState
();
const
{
data
,
loading
,
refresh
}
=
useRequest
(()
=>
{
return
doFetch
({
url
,
params
:
params
??
{}
})
return
doFetch
({
url
,
params
:
params
??
{}
});
});
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
(
true
);
const
allkeys
=
useMemo
(()
=>
{
let
res
=
[];
const
fn
=
(
source
)
=>
{
source
.
map
(
el
=>
{
res
.
push
(
el
)
el
.
children
&&
el
.
children
.
length
>
0
?
fn
(
el
.
children
)
:
""
// 子级递归
})
}
source
.
map
((
el
)
=>
{
res
.
push
(
el
);
el
.
children
&&
el
.
children
.
length
>
0
?
fn
(
el
.
children
)
:
""
;
// 子级递归
});
};
fn
(
data
?.
data
?.
dataList
??
[]);
return
res
.
filter
(
it
=>
it
.
children
).
map
(
it
=>
it
.
key
)
},
[
data
])
return
res
.
filter
((
it
)
=>
it
.
children
).
map
((
it
)
=>
it
.
key
);
},
[
data
]);
const
alldata
=
useMemo
(()
=>
{
let
res
=
[];
const
fn
=
(
source
)
=>
{
source
.
map
(
el
=>
{
res
.
push
(
el
)
el
.
children
&&
el
.
children
.
length
>
0
?
fn
(
el
.
children
)
:
""
// 子级递归
})
}
source
.
map
((
el
)
=>
{
res
.
push
(
el
);
el
.
children
&&
el
.
children
.
length
>
0
?
fn
(
el
.
children
)
:
""
;
// 子级递归
});
};
fn
(
data
?.
data
?.
dataList
??
[]);
return
res
},
[
data
])
return
res
;
},
[
data
]);
const
treeData
=
useMemo
(()
=>
{
let
res
=
data
?.
data
?.
dataList
??
[];
return
[
{
title
:
"全部"
,
key
:
"00000000"
,
children
:
res
}
]
children
:
res
,
},
];
},
[
data
]);
const
onChange
=
(
e
)
=>
{
const
{
value
}
=
e
.
target
;
const
dataLists
=
getAllList
();
const
newExpandedKeys
=
dataLists
.
map
((
item
)
=>
{
const
newExpandedKeys
=
dataLists
.
map
((
item
)
=>
{
if
(
item
.
title
.
indexOf
(
value
)
>
-
1
)
{
return
getParentKey
(
item
.
key
,
treeData
);
}
return
null
;
}).
filter
((
item
,
i
,
self
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
})
.
filter
((
item
,
i
,
self
)
=>
item
&&
self
.
indexOf
(
item
)
===
i
);
setsearch
(
value
);
if
(
newExpandedKeys
.
length
>
0
)
{
if
(
newExpandedKeys
.
length
>
0
)
{
setexpandall
(
true
);
setAutoExpandParent
(
true
)
}
else
{
setAutoExpandParent
(
true
);
}
else
{
setexpandall
(
false
);
setAutoExpandParent
(
false
)
setAutoExpandParent
(
false
);
}
onExpand
(
newExpandedKeys
);
};
const
loop
=
data
=>
data
.
map
(
item
=>
{
const
loop
=
(
data
)
=>
data
.
map
((
item
)
=>
{
const
index
=
item
.
title
.
indexOf
(
search
);
const
beforeStr
=
item
.
title
.
substr
(
0
,
index
);
const
afterStr
=
item
.
title
.
substr
(
index
+
search
.
length
);
let
title
=
index
>
-
1
?
(
<
Tooltip
title=
{
item
.
title
}
placement=
"bottom"
>
<
span
style=
{
{
display
:
"inline-block"
,
maxWidth
:
maxWidth
??
88
,
overflow
:
"hidden"
,
textOverflow
:
"ellipsis"
,
whiteSpace
:
"nowrap"
}
}
>
<
span
style=
{
{
display
:
"inline-block"
,
maxWidth
:
maxWidth
??
88
,
overflow
:
"hidden"
,
textOverflow
:
"ellipsis"
,
whiteSpace
:
"nowrap"
,
}
}
>
{
beforeStr
}
<
span
style=
{
{
color
:
'#f50'
}
}
>
{
search
}
</
span
>
<
span
style=
{
{
color
:
"#f50"
}
}
>
{
search
}
</
span
>
{
afterStr
}
</
span
>
</
Tooltip
>
)
:
(
<
Tooltip
title=
{
item
.
title
}
placement=
"bottom"
>
<
span
style=
{
{
display
:
"inline-block"
,
maxWidth
:
maxWidth
??
88
,
overflow
:
"hidden"
,
textOverflow
:
"ellipsis"
,
whiteSpace
:
"nowrap"
}
}
>
{
item
.
title
}
</
span
>
<
span
style=
{
{
display
:
"inline-block"
,
maxWidth
:
maxWidth
??
88
,
overflow
:
"hidden"
,
textOverflow
:
"ellipsis"
,
whiteSpace
:
"nowrap"
,
}
}
>
{
item
.
title
}
</
span
>
</
Tooltip
>
);
const
actiontitle
=
(
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
}
}
>
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
,
}
}
>
{
title
}
<
div
>
{
item
.
key
&&
item
.
key
!=
"0"
&&
<
Tooltip
title=
"编辑"
onClick=
{
(
e
)
=>
{
{
item
.
key
&&
item
.
key
!=
"00000000"
&&
(
<
Tooltip
title=
"编辑"
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setsavetitle
(
null
)
setsavetitle
(
null
);
if
(
getPrem
(
"enElectricityMeterType_save"
,
"ifs"
))
{
setModal
({
visible
:
true
,
...
...
@@ -128,22 +179,23 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
okText
:
"修改"
,
cancelText
:
"取消"
,
placeholder
:
item
.
title
,
key
:
item
.
key
})
key
:
item
.
key
,
});
}
}
}
>
}
}
>
<
FormOutlined
style=
{
{
color
:
"#1890ff"
}
}
/>
</
Tooltip
>
}
{
item
.
key
&&
<
Divider
type=
'vertical'
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
}
)
}
{
(
item
.
key
&&
item
.
key
!=
"00000000"
)
&&
(
<
Divider
type=
"vertical"
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
)
}
<
Tooltip
title=
"新增"
>
<
PlusSquareOutlined
disabled=
{
!
getPrem
(
"enElectricityMeterType_save"
,
"ifs"
)
}
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setsavetitle
(
null
)
setsavetitle
(
null
);
if
(
getPrem
(
"enElectricityMeterType_save"
,
"ifs"
))
{
setModal
({
visible
:
true
,
...
...
@@ -152,38 +204,48 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
okText
:
"新增"
,
cancelText
:
"取消"
,
placeholder
:
item
.
title
,
key
:
item
.
key
})
key
:
item
.
key
,
});
}
}
}
style=
{
{
color
:
`${getPrem("enElectricityMeterType_save", "ifs") ? "green" : ""}`
}
}
/></
Tooltip
>
{
(
!
item
.
children
||
item
.
children
.
length
==
0
)
&&
<
Divider
type=
'vertical'
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
}
{
(
!
item
.
children
||
item
.
children
.
length
==
0
)
&&
(
item
.
key
!=
"0"
)
&&
style=
{
{
color
:
`${
getPrem("enElectricityMeterType_save", "ifs") ? "green" : ""
}`
,
}
}
/>
</
Tooltip
>
{
(
!
item
.
children
||
item
.
children
.
length
==
0
)
&&
(
<
Divider
type=
"vertical"
style=
{
{
margin
:
"0 6px"
}
}
></
Divider
>
)
}
{
(
!
item
.
children
||
item
.
children
.
length
==
0
)
&&
item
.
key
!=
"0"
&&
(
<
Popconfirm
placement=
'bottom'
placement=
"bottom"
title=
"是否删除该节点?"
okText=
"删除"
cancelText=
"取消"
onConfirm=
{
()
=>
{
doFetch
({
url
:
deleteurl
,
params
:
{
id
:
item
.
key
}
}).
then
(
res
=>
{
if
(
res
.
code
==
'0000'
)
{
message
.
success
(
"操作成功"
)
doFetch
({
url
:
deleteurl
,
params
:
{
id
:
item
.
key
}
}).
then
(
(
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
message
.
success
(
"操作成功"
);
refresh
();
}
})
}
);
}
}
disabled=
{
!
getPrem
(
"enElectricityMeterType_deleteById"
,
"ifs"
)
}
>
<
Tooltip
title=
"删除"
>
<
MinusSquareOutlined
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
()
}
}
style=
{
{
color
:
"red"
}
}
/>
<
MinusSquareOutlined
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
}
}
style=
{
{
color
:
"red"
}
}
/>
</
Tooltip
>
</
Popconfirm
>
}
)
}
{
/* {
item.key === "00000000" && <Divider type='vertical' style={{ margin: "0 6px" }}></Divider>
} */
}
...
...
@@ -197,26 +259,34 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
</Tooltip>
} */
}
</
div
>
</
div
>
)
);
if
(
item
.
key
===
"00000000"
)
{
title
=
(
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
,
flex
:
1
}
}
>
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
,
justifyContent
:
"space-between"
,
flex
:
1
,
}
}
>
{
title
}
<
Tooltip
title=
{
expandall
?
"收起"
:
"展开"
}
onClick=
{
(
e
)
=>
{
<
Tooltip
title=
{
expandall
?
"收起"
:
"展开"
}
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setexpandall
(
!
expandall
)
onExpand
(
expandall
?
[]
:
allkeys
)
setAutoExpandParent
(
!
expandall
)
}
}
>
setexpandall
(
!
expandall
);
onExpand
(
expandall
?
[]
:
allkeys
);
setAutoExpandParent
(
!
expandall
);
}
}
>
{
expandall
?
<
ArrowDownOutlined
/>
:
<
ArrowRightOutlined
/>
}
</
Tooltip
>
</
div
>
)
);
}
// if (item.children) {
// return (
// <TreeNode key={item.key} title={actiontitle}>
...
...
@@ -236,22 +306,22 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
title
:
noaction
?
title
:
actiontitle
,
key
:
item
.
key
,
children
:
loop
(
item
.
children
),
level
:
item
.
level
level
:
item
.
level
,
};
}
return
{
title
:
noaction
?
title
:
actiontitle
,
key
:
item
.
key
,
level
:
item
.
level
level
:
item
.
level
,
};
});
useEffect
(()
=>
{
setexpandall
(
true
);
onExpand
(
allkeys
)
onExpand
(
allkeys
);
},
[
allkeys
]);
function
getAllList
()
{
const
dataLists
=
[];
const
generateLists
=
data
=>
{
const
generateLists
=
(
data
)
=>
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
const
node
=
data
[
i
];
const
key
=
node
.
key
;
...
...
@@ -269,10 +339,10 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
<
Modal
{
...
modal
}
onCancel=
{
()
=>
{
setModal
(
s
=>
({
setModal
((
s
)
=>
({
...
s
,
visible
:
false
}))
visible
:
false
,
}));
}
}
onOk=
{
()
=>
{
if
(
modal
.
okText
==
"修改"
)
{
...
...
@@ -283,23 +353,23 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
params
:
{
materieTypeName
:
savetitle
,
id
:
modal
.
key
,
}
}).
then
(
res
=>
{
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
message
.
success
(
"操作成功"
)
message
.
success
(
"操作成功"
);
refresh
()
refresh
();
setModal
({
visible
:
false
})
visible
:
false
,
});
}
})
resolve
()
});
resolve
();
}
else
{
message
.
warn
(
"请输入修改的名称"
)
reject
()
message
.
warn
(
"请输入修改的名称"
);
reject
();
}
})
});
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
savetitle
)
{
...
...
@@ -308,46 +378,61 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
params
:
{
materieTypeName
:
savetitle
,
parentId
:
modal
.
key
,
}
}).
then
(
res
=>
{
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
message
.
success
(
"操作成功"
)
refresh
()
message
.
success
(
"操作成功"
);
refresh
();
setModal
({
visible
:
false
})
visible
:
false
,
});
}
})
resolve
()
});
resolve
();
}
else
{
message
.
warn
(
"请输入修改的名称"
)
reject
()
message
.
warn
(
"请输入修改的名称"
);
reject
();
}
})
});
}
}
}
>
{
modal
.
okText
==
"修改"
?
{
modal
.
okText
==
"修改"
?
(
<
div
>
<
Input
placeholder=
{
modal
.
placeholder
}
allowClear
value=
{
savetitle
}
onChange=
{
(
e
)
=>
{
setsavetitle
(
e
.
target
.
value
)
}
}
></
Input
>
</
div
>
:
<
Input
placeholder=
{
modal
.
placeholder
}
allowClear
value=
{
savetitle
}
onChange=
{
(
e
)
=>
{
setsavetitle
(
e
.
target
.
value
);
}
}
></
Input
>
</
div
>
)
:
(
<
div
>
<
div
style=
{
{
marginBottom
:
15
,
color
:
"#f50"
,
fontSize
:
16
}
}
>
当前结构:
{
modal
.
placeholder
}
</
div
>
<
Input
placeholder=
"子结构"
allowClear
onChange=
{
(
e
)
=>
{
setsavetitle
(
e
.
target
.
value
)
}
}
></
Input
>
<
div
style=
{
{
marginBottom
:
15
,
color
:
"#f50"
,
fontSize
:
16
}
}
>
当前结构:
{
modal
.
placeholder
}
</
div
>
}
<
Input
placeholder=
"子结构"
allowClear
onChange=
{
(
e
)
=>
{
setsavetitle
(
e
.
target
.
value
);
}
}
></
Input
>
</
div
>
)
}
</
Modal
>
<
Search
value=
{
search
}
style=
{
{
margin
:
'16px 0 8px 0'
}
}
placeholder=
"搜索"
onChange=
{
onChange
}
/>
<
Search
value=
{
search
}
style=
{
{
margin
:
"16px 0 8px 0"
}
}
placeholder=
"搜索"
onChange=
{
onChange
}
/>
<
Tree
onSelect=
{
(
selectedKeys
,
e
)
=>
{
onselected
?.(
selectedKeys
,
e
,
alldata
)
onselected
?.(
selectedKeys
,
e
,
alldata
);
}
}
autoExpandParent=
{
autoExpandParent
}
defaultExpandAll=
{
true
}
...
...
@@ -356,9 +441,9 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
onExpand
(
expandedKeys
);
setAutoExpandParent
(
false
);
if
(
!
bool
&&
node
.
key
==
"00000000"
)
{
setexpandall
(
false
)
setexpandall
(
false
);
}
else
{
setexpandall
(
true
)
setexpandall
(
true
);
}
}
}
treeData=
{
loop
(
treeData
??
[])
}
...
...
@@ -366,7 +451,6 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
{
/* {loop(treeData ? treeData : [])} */
}
</
Tree
>
</
div
>
);
}
...
...
src/pages/craft/Materiel/Index.jsx
View file @
2b7e6c2d
...
...
@@ -9,7 +9,7 @@ import Details from "@/components/Details";
import
{
materielDetail
}
from
"@/utils/detailTotalCard"
;
import
InitForm
from
"@/components/InitForm"
;
import
moment
from
"moment"
;
import
TreeRender
from
'@/components/TreeRender'
import
TreeRender
from
"@/components/TreeRender"
;
import
{
useEffect
}
from
"react"
;
const
initState
=
{
...
...
@@ -25,14 +25,14 @@ const initState = {
specificFileds
:
{},
commonFields
:
{},
defaultCommonFields
:
[],
},
otherBasic
=
{
},
otherBasic
=
{
materieCode
:
"物料编号"
,
materieName
:
"物料名称"
,
materieTypeName
:
"物料类型"
,
productionUnitName
:
"生产单位(主)"
,
processLineName
:
"工艺路线"
,
};
};
function
reducer
(
state
,
action
)
{
let
{
type
}
=
action
,
newState
=
{};
...
...
@@ -203,7 +203,12 @@ const Materiel = (props) => {
itemData
:
newSpecialData
,
},
];
dataSource
.
newqualityGuaranteePeriod
=
dataSource
.
qualityGuaranteePeriod
==
0
||
dataSource
.
qualityGuaranteePeriod
?
dataSource
.
qualityGuaranteePeriod
+
dataSource
.
qualityGuaranteePeriodUnitName
:
null
;
dataSource
.
newqualityGuaranteePeriod
=
dataSource
.
qualityGuaranteePeriod
==
0
||
dataSource
.
qualityGuaranteePeriod
?
dataSource
.
qualityGuaranteePeriod
+
dataSource
.
qualityGuaranteePeriodUnitName
:
null
;
let
totalCard
=
materielDetail
.
concat
(
itemCol
);
dispatch
({
type
:
"see"
,
dataSource
,
totalCard
});
}
...
...
@@ -220,15 +225,18 @@ const Materiel = (props) => {
title
:
"物料类型"
,
dataIndex
:
"materieTypeName"
,
key
:
"materieTypeName"
,
search
:
false
search
:
false
,
},
{
title
:
"物料管控"
,
dataIndex
:
"materieControlName"
,
key
:
"materieControlName"
,
options
:
{
database
:
()
=>
doFetch
({
url
:
"/ngic-base-business/sysDic/queryMaterieControlSelect"
}),
params
:
{}
database
:
()
=>
doFetch
({
url
:
"/ngic-base-business/sysDic/queryMaterieControlSelect"
,
}),
params
:
{},
},
valueType
:
"select"
,
formItemProps
:
{
...
...
@@ -241,17 +249,21 @@ const Materiel = (props) => {
key
:
"qualityGuaranteePeriod"
,
search
:
false
,
render
:
(
text
,
row
)
=>
{
return
(
row
.
qualityGuaranteePeriod
??
""
)
+
" - "
+
(
row
.
qualityGuaranteePeriodUnitName
??
""
)
}
return
(
(
row
.
qualityGuaranteePeriod
??
""
)
+
" - "
+
(
row
.
qualityGuaranteePeriodUnitName
??
""
)
);
},
},
{
title
:
"
最大库存
"
,
title
:
"
库存上限
"
,
dataIndex
:
"inventoryMax"
,
key
:
"inventoryMax"
,
search
:
false
,
},
{
title
:
"
最小库存
"
,
title
:
"
库存下限
"
,
dataIndex
:
"inventoryMin"
,
key
:
"inventoryMin"
,
search
:
false
,
...
...
@@ -262,13 +274,15 @@ const Materiel = (props) => {
dataIndex
:
"productionUnitName"
,
key
:
"productionUnit"
,
options
:
{
database
:
()
=>
doFetch
({
url
:
"/ngic-base-business/sysDic/queryMaterieUnitSelect"
}),
params
:
{}
database
:
()
=>
doFetch
({
url
:
"/ngic-base-business/sysDic/queryMaterieUnitSelect"
,
}),
params
:
{},
},
valueType
:
"select"
,
},
{
title
:
"操作"
,
dataIndex
:
"option_dataindex"
,
...
...
@@ -279,12 +293,13 @@ const Materiel = (props) => {
},
];
useEffect
(()
=>
{
doFetch
({
url
:
"/ngic-workmanship/pmMaterieChar/queryCommonList"
,
params
:
{}
}).
then
(
res
=>
{
setdefaultSpecificFileds
(
res
?.
data
?.
dataList
)
})
},
[])
doFetch
({
url
:
"/ngic-workmanship/pmMaterieChar/queryCommonList"
,
params
:
{},
}).
then
((
res
)
=>
{
setdefaultSpecificFileds
(
res
?.
data
?.
dataList
);
});
},
[]);
function
extraAction
(
text
,
record
,
_
,
action
)
{
return
[
...
...
@@ -342,7 +357,7 @@ const Materiel = (props) => {
specificFileds
:
{
...
commonDataFields
},
defaultCommonFields
:
newCommonData
,
});
setdefaultSpecificFileds
([...
newCommonData
])
setdefaultSpecificFileds
([...
newCommonData
])
;
});
}
});
...
...
@@ -392,12 +407,13 @@ const Materiel = (props) => {
};
return
el
;
});
let
materieProductUnitList
=
firstValues
.
materieProductUnitList
.
map
(
it
=>
{
let
materieProductUnitList
=
firstValues
.
materieProductUnitList
.
map
((
it
)
=>
{
return
{
productionUnit
:
it
.
productionUnit
,
conversionRate
:
it
.
conversionRate
}
})
conversionRate
:
it
.
conversionRate
,
};
});
params
=
{
...
firstValues
,
...
...
@@ -408,9 +424,9 @@ const Materiel = (props) => {
url
=
"/ngic-workmanship/pmMaterie/save"
;
run
({
url
,
params
});
})
.
catch
((
error
)
=>
{
});
.
catch
((
error
)
=>
{});
})
.
catch
((
error
)
=>
{
});
.
catch
((
error
)
=>
{});
}
else
{
url
=
"/ngic-workmanship/pmMaterie/saveMaterieBom"
;
let
firstValues
=
formRef
?.
getFieldsValue
();
...
...
@@ -461,7 +477,8 @@ const Materiel = (props) => {
defaultFields
[
i
].
value
=
1
;
}
if
(
i
==
"materieTypeId"
)
{
defaultFields
[
i
].
value
=
materieTypeId
;
defaultFields
[
i
].
value
=
materieTypeId
==
"00000000"
?
null
:
materieTypeId
;
}
}
dispatch
({
...
...
@@ -529,18 +546,25 @@ const Materiel = (props) => {
childposition=
"left"
extraparams=
{
{
materieTypeId
:
materieTypeId
}
}
>
<
div
style=
{
{
width
:
260
,
flexShrink
:
0
,
marginTop
:
-
4
,
borderRight
:
"1px solid #f0f0f0"
,
paddingRight
:
12
,
marginRight
:
12
}
}
>
<
div
style=
{
{
width
:
260
,
flexShrink
:
0
,
marginTop
:
-
4
,
borderRight
:
"1px solid #f0f0f0"
,
paddingRight
:
12
,
marginRight
:
12
,
}
}
>
<
TreeRender
url=
"/ngic-workmanship/pmMaterieType/queryTreeList"
deleteurl=
"/ngic-workmanship/pmMaterieType/deleteById"
saveurl=
"/ngic-workmanship/pmMaterieType/save"
onselected=
{
(
vals
)
=>
{
setmaterieTypeId
(
vals
[
0
]
??
''
)
setmaterieTypeId
(
vals
[
0
]
??
""
);
}
}
/>
</
div
>
</
AutoTable
>
<
Drawer
title=
{
iftype
.
title
}
...
...
@@ -552,13 +576,12 @@ const Materiel = (props) => {
style=
{
{
position
:
"absolute"
}
}
width=
{
"100%"
}
>
{
(
{
<>
<
InitForm
formRef=
{
formRef
}
fields=
{
fields
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
}
}
onChange=
{
(
changedValues
,
allValues
)
=>
{}
}
actions=
{
()
=>
{
return
null
;
}
}
...
...
@@ -569,13 +592,13 @@ const Materiel = (props) => {
<
InitForm
formRef=
{
formRefs
}
fields=
{
specificFileds
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
}
}
onChange=
{
(
changedValues
,
allValues
)
=>
{}
}
actions=
{
()
=>
{
return
null
;
}
}
></
InitForm
>
</>
)
}
}
<
Button
style=
{
{
width
:
"100%"
}
}
type=
"primary"
...
...
src/pages/craft/Materiel/fields.js
View file @
2b7e6c2d
...
...
@@ -47,14 +47,14 @@ export default {
inventoryMin
:
{
value
:
null
,
type
:
"inputnumber"
,
title
:
"库存
最小值
"
,
title
:
"库存
下限
"
,
name
:
[
"inventoryMin"
],
required
:
false
,
},
inventoryMax
:
{
value
:
null
,
type
:
"inputnumber"
,
title
:
"库存
最大值
"
,
title
:
"库存
上限
"
,
name
:
[
"inventoryMax"
],
required
:
false
,
},
...
...
@@ -63,7 +63,7 @@ export default {
type
:
"select"
,
title
:
"库存单位"
,
name
:
[
"productionUnit"
],
required
:
fals
e
,
required
:
tru
e
,
options
:
{
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-base-business/sysDic/queryMaterieUnitSelect"
,
params
}),
params
:
{}
...
...
@@ -78,7 +78,7 @@ export default {
},
qualityGuaranteePeriodUnit
:
{
value
:
null
,
type
:
"
radio
"
,
type
:
"
select
"
,
title
:
"保质期单位"
,
name
:
[
"qualityGuaranteePeriodUnit"
],
required
:
false
,
...
...
@@ -120,7 +120,7 @@ export default {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materieProductUnitList"
],
required
:
tru
e
,
required
:
fals
e
,
columns
:
[
{
title
:
"辅助单位"
,
...
...
@@ -134,7 +134,7 @@ export default {
},
},
{
title
:
"转换比"
,
title
:
"转换比
库存单位=辅助单位*转换比”
"
,
dataIndex
:
"conversionRate"
,
key
:
"conversionRate"
,
search
:
false
,
...
...
src/pages/insertstore/Instore/fields.js
View file @
2b7e6c2d
...
...
@@ -33,7 +33,7 @@ const EditUpload = ({ record, fid, storeId }) => {
...
s
,
submit
:
{
id
:
fid
,
materialList
:
(
s
.
submit
&&
s
?.
submit
?.
materialList
)
?
s
?.
submit
?.
materialList
?.
filter
(
it
=>
newlist
.
map
(
item
=>
item
.
id
).
indexOf
(
it
.
id
)
==-
1
)?.
concat
(
newlist
)?.
filter
(
it
=>
it
.
uploadList
?.
length
>
0
)
:
[]
materialList
:
(
s
.
submit
&&
s
?.
submit
?.
materialList
)
?
s
?.
submit
?.
materialList
?.
filter
(
it
=>
newlist
.
map
(
item
=>
item
.
id
).
indexOf
(
it
.
id
)
==
-
1
)?.
concat
(
newlist
)?.
filter
(
it
=>
it
.
uploadList
?.
length
>
0
)
:
[]
}
})
})
...
...
@@ -44,29 +44,39 @@ const EditUpload = ({ record, fid, storeId }) => {
style
=
{{
marginLeft
:
48
}}
columns
=
{[
{
title
:
"库位名称"
,
title
:
<
span
>
库位名称
<
b
style
=
{{
color
:
"red"
}}
>*<
/b></
span
>
,
dataIndex
:
"storePositionName"
,
key
:
"storePositionId"
,
search
:
false
,
valueType
:
"select"
,
request
:
async
(
params
)
=>
{
let
res
=
await
doFetch
({
url
:
"/ngic-auth/sysStorePosition/queryByStoreId/selection"
,
params
:
{
storeId
:
params
.
storeId
}
});
let
res
=
await
doFetch
({
url
:
"/ngic-auth/sysStorePosition/queryByStoreId/selection"
,
params
:
{
storeId
:
params
.
storeId
}
});
return
res
?.
data
?.
dataList
},
editable
:
(
text
,
record
,
index
)
=>
{
return
!
record
.
materieOutstoreDetailId
},
params
:{
storeId
:
storeId
}
params
:
{
storeId
:
storeId
},
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
},
{
title
:
"上架数量"
,
title
:
<
span
>
上架数量
<
b
style
=
{{
color
:
"red"
}}
>*<
/b></
span
>
,
dataIndex
:
"instroeNum"
,
key
:
"instroeNum"
,
search
:
false
,
editable
:
(
text
,
record
,
index
)
=>
{
return
!
record
.
materieOutstoreDetailId
},
valueType
:
"digit"
valueType
:
"digit"
,
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
},
{
title
:
"备注"
,
...
...
@@ -127,7 +137,7 @@ const one = {
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
入库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -177,7 +187,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/pmMaterie/queryUnitByMaterieId"
,
params
}),
...
...
@@ -228,11 +238,11 @@ const one = {
}
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
,
"width"
:
60
"width"
:
88
},
{
title
:
"操作"
,
...
...
@@ -262,7 +272,7 @@ const one = {
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
入库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -315,7 +325,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/pmMaterie/queryUnitByMaterieId"
,
params
}),
...
...
@@ -366,11 +376,11 @@ const one = {
valueType
:
"digit"
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
,
"width"
:
60
"width"
:
88
},
{
title
:
"操作"
,
...
...
@@ -400,7 +410,7 @@ const one = {
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
入库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -437,7 +447,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/pmMaterie/queryUnitByMaterieId"
,
params
}),
...
...
@@ -509,11 +519,11 @@ const one = {
valueType
:
"digit"
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
,
"width"
:
60
"width"
:
88
},
{
title
:
"操作"
,
...
...
@@ -543,7 +553,7 @@ const one = {
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
入库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -580,7 +590,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/pmMaterie/queryUnitByMaterieId"
,
params
}),
...
...
@@ -652,11 +662,11 @@ const one = {
valueType
:
"digit"
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
,
"width"
:
60
"width"
:
88
},
{
title
:
"操作"
,
...
...
@@ -767,7 +777,7 @@ const one = {
search
:
false
,
},
{
title
:
"单位"
,
title
:
"
库存
单位"
,
dataIndex
:
"productionUnitName"
,
key
:
"productionUnitName"
,
search
:
false
,
...
...
@@ -783,12 +793,22 @@ const one = {
dataIndex
:
"storePositionName"
,
key
:
"storePositionName"
,
search
:
false
,
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
},
{
title
:
"上架数量"
,
dataIndex
:
"instroeNum"
,
key
:
"instroeNum"
,
search
:
false
search
:
false
,
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
}
]}
dataSource
=
{
record
.
uploadList
}
...
...
@@ -853,7 +873,7 @@ const one = {
search
:
false
,
},
{
title
:
"单位"
,
title
:
"
库存
单位"
,
dataIndex
:
"productionUnitName"
,
key
:
"productionUnitName"
,
search
:
false
,
...
...
@@ -869,12 +889,22 @@ const one = {
dataIndex
:
"storePositionName"
,
key
:
"storePositionName"
,
search
:
false
,
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
},
{
title
:
"上架数量"
,
dataIndex
:
"instroeNum"
,
key
:
"instroeNum"
,
search
:
false
search
:
false
,
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
}
,
{
...
...
@@ -995,7 +1025,7 @@ const one = {
search
:
false
,
},
{
title
:
"单位"
,
title
:
"
库存
单位"
,
dataIndex
:
"productionUnitName"
,
key
:
"productionUnitName"
,
search
:
false
,
...
...
src/pages/insertstore/Instore/index.jsx
View file @
2b7e6c2d
...
...
@@ -51,7 +51,12 @@ const keytoval = {
</
a
>
),
},
]
],
itemz
=
{
one
:
"采购入库"
,
two
:
"生产入库"
,
three
:
"退料入库"
,
four
:
"其他入库"
}
function
Instore
(
props
)
{
const
{
initialState
,
setInitialState
}
=
useModel
(
"@@initialState"
);
...
...
@@ -365,7 +370,7 @@ function Instore(props) {
setdrawprops
(
s
=>
({
...
s
,
visible
:
true
,
title
:
"新增"
,
title
:
"新增"
+
itemz
[
e
.
key
]
,
fields
:
defaultFields
[
e
.
key
],
instoreType
:
keytoval
[
e
.
key
],
val
:
"add"
,
//类型
...
...
src/pages/outsetstore/Outstore/fields.js
View file @
2b7e6c2d
...
...
@@ -71,7 +71,12 @@ const EditUpload = ({ record, fid, storeId }) => {
editable
:
(
text
,
record
,
index
)
=>
{
return
!
record
.
materieOutstoreDetailId
},
params
:{
storeId
:
storeId
}
params
:{
storeId
:
storeId
},
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
},
{
title
:
"批次号/SN号"
,
...
...
@@ -162,12 +167,12 @@ const one = {
"materieOutstoreNo"
],
"required"
:
false
,
placeholder
:
"不填写系统自动生成"
"placeholder"
:
"不填写系统自动生成"
},
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
出库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -176,7 +181,7 @@ const one = {
database
:
()
=>
doFetch
({
url
:
"/ngic-auth/sysStore/selectionBox"
,
params
:
{
factoryIdList
:
[]
}
}),
params
:
{}
},
linked
:
true
"linked"
:
true
},
"businessNo"
:
{
"value"
:
null
,
...
...
@@ -205,7 +210,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieStockStore/queryStoreOne"
,
params
}),
...
...
@@ -258,7 +263,7 @@ const one = {
"readonly"
:
'usableNum'
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
...
...
@@ -291,7 +296,7 @@ const one = {
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
出库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -328,7 +333,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieStockStore/queryStoreOne"
,
params
}),
...
...
@@ -379,7 +384,7 @@ const one = {
"readonly"
:
'usableNum'
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
...
...
@@ -412,7 +417,7 @@ const one = {
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
出库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -449,7 +454,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieStockStore/queryStoreOne"
,
params
}),
...
...
@@ -500,7 +505,7 @@ const one = {
"readonly"
:
'usableNum'
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
...
...
@@ -533,7 +538,7 @@ const one = {
"storeId"
:
{
"value"
:
null
,
"type"
:
"select"
,
"title"
:
"仓库"
,
"title"
:
"
出库
仓库"
,
"name"
:
[
"storeId"
],
...
...
@@ -570,7 +575,7 @@ const one = {
type
:
"table"
,
col
:
{
span
:
24
},
name
:
[
"materialList"
],
required
:
tru
e
,
required
:
fals
e
,
linkconfig
:
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieStockStore/queryStoreOne"
,
params
}),
...
...
@@ -621,7 +626,7 @@ const one = {
"readonly"
:
'usableNum'
},
{
"title"
:
"单位"
,
"title"
:
"
库存
单位"
,
"dataIndex"
:
"productionUnitName"
,
"key"
:
"productionUnitName"
,
"readonly"
:
'productionUnitName'
...
...
@@ -715,7 +720,7 @@ const one = {
search
:
false
,
},
{
title
:
"单位"
,
title
:
"
库存
单位"
,
dataIndex
:
"productionUnitName"
,
key
:
"productionUnitName"
,
search
:
false
,
...
...
@@ -736,6 +741,11 @@ const one = {
dataIndex
:
"storePositionName"
,
key
:
"storePositionName"
,
search
:
false
,
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
},
{
title
:
"批次号/SN号"
,
...
...
@@ -805,7 +815,7 @@ const one = {
search
:
false
,
},
{
title
:
"单位"
,
title
:
"
库存
单位"
,
dataIndex
:
"productionUnitName"
,
key
:
"productionUnitName"
,
search
:
false
,
...
...
@@ -821,6 +831,11 @@ const one = {
dataIndex
:
"storePositionName"
,
key
:
"storePositionName"
,
search
:
false
,
"formItemProps"
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}],
};
},
},
{
title
:
"批次号/SN号"
,
...
...
@@ -942,7 +957,7 @@ const one = {
search
:
false
,
},
{
title
:
"单位"
,
title
:
"
库存
单位"
,
dataIndex
:
"productionUnitName"
,
key
:
"productionUnitName"
,
search
:
false
,
...
...
src/pages/outsetstore/Outstore/index.jsx
View file @
2b7e6c2d
import
React
,
{
useEffect
,
useMemo
,
useRef
,
useState
}
from
"react"
;
import
{
Dropdown
,
Menu
,
Button
,
message
,
}
from
"antd"
;
import
{
Dropdown
,
Menu
,
Button
,
message
}
from
"antd"
;
import
AutoTable
from
"@/components/AutoTable"
;
import
defaultFields
from
"./fields"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
DrawInitForm
from
"@/components/DrawInitForm"
;
import
getPrem
from
'@/utils/getPrem'
;
//权限判断fn
import
{
useReactToPrint
}
from
'react-to-print'
;
import
{
useModel
}
from
'umi'
;
import
getPrem
from
"@/utils/getPrem"
;
//权限判断fn
import
{
useReactToPrint
}
from
"react-to-print"
;
import
{
useModel
}
from
"umi"
;
const
keytoval
=
{
"one"
:
1
,
"two"
:
2
,
"three"
:
3
,
"four"
:
4
},
items
=
[
{
key
:
'one'
,
label
:
(
<
a
>
生产领料出库
</
a
>
),
one
:
1
,
two
:
2
,
three
:
3
,
four
:
4
,
},
items
=
[
{
key
:
'two'
,
label
:
(
<
a
>
销售出库
</
a
>
),
key
:
"one"
,
label
:
<
a
>
生产领料出库
</
a
>,
},
{
key
:
'three'
,
label
:
(
<
a
>
报废出库
</
a
>
),
key
:
"two"
,
label
:
<
a
>
销售出库
</
a
>,
},
{
key
:
'four'
,
label
:
(
<
a
>
其他出库
</
a
>
),
key
:
"three"
,
label
:
<
a
>
报废出库
</
a
>,
},
]
{
key
:
"four"
,
label
:
<
a
>
其他出库
</
a
>,
},
],
itemz
=
{
one
:
"生产领料出库"
,
two
:
"销售出库"
,
three
:
"报废出库"
,
four
:
"其他出库"
,
};
function
Outstore
(
props
)
{
const
{
initialState
,
setInitialState
}
=
useModel
(
"@@initialState"
);
...
...
@@ -60,14 +46,14 @@ function Outstore(props) {
title
:
""
,
visible
:
false
,
onClose
:
()
=>
{
setdrawprops
(
s
=>
({
setdrawprops
((
s
)
=>
({
...
s
,
visible
:
false
,
fields
:
{}
}))
fields
:
{},
}));
},
fields
:
{},
width
:
1200
width
:
1200
,
}),
actionRef
=
useRef
(),
ChildRef
=
null
,
...
...
@@ -78,326 +64,372 @@ function Outstore(props) {
actionRef
.
current
.
reload
();
ChildRef
?.
onRefresh
();
message
.
success
(
"操作成功"
);
setdrawprops
(
s
=>
({
setdrawprops
((
s
)
=>
({
...
s
,
visible
:
false
,
fields
:
{}
}))
fields
:
{},
}));
}
const
handlePrint
=
useReactToPrint
({
content
:
()
=>
printRef
.
current
,
});
const
columns
=
useMemo
(()
=>
{
if
(
activeTabKey
==
"1"
)
{
return
[
{
"title"
:
"出库单号"
,
"dataIndex"
:
"materieOutstoreNo"
,
"key"
:
"materieOutstoreNo"
,
"render"
:
(
dom
,
record
)
=>
{
return
<
a
title
:
"出库单号"
,
dataIndex
:
"materieOutstoreNo"
,
key
:
"materieOutstoreNo"
,
render
:
(
dom
,
record
)
=>
{
return
(
<
a
onClick=
{
()
=>
{
setdrawprops
(
s
=>
({
setdrawprops
((
s
)
=>
({
...
s
,
visible
:
true
,
//查看详情 props
val
:
"detail"
,
title
:
`查看详情`
,
...
defaultFields
?.
detail
,
totalPath
:
"/ngic-workmanship/wmsMaterieOutstore/getOutStoreInfoById"
,
totalPath
:
"/ngic-workmanship/wmsMaterieOutstore/getOutStoreInfoById"
,
totalParams
:
{
id
:
record
.
id
},
printRef
:
printRef
,
extra
:
(<
Button
extra
:
(
<
Button
onClick=
{
async
()
=>
{
handlePrint
()
handlePrint
();
}
}
>
打印
</
Button
>)
}))
</
Button
>
),
}));
}
}
>
{
dom
}
</
a
>
}
>
{
dom
}
</
a
>
);
},
},
{
"title"
:
"出库类型"
,
"dataIndex"
:
"outstoreTypeName"
,
"key"
:
"outstoreType"
,
"valueType"
:
"select"
,
"options"
:
[
title
:
"出库类型"
,
dataIndex
:
"outstoreTypeName"
,
key
:
"outstoreType"
,
valueType
:
"select"
,
options
:
[
{
"label"
:
"生产领料出库"
,
"value"
:
"1"
label
:
"生产领料出库"
,
value
:
"1"
,
},
{
"label"
:
"销售出库"
,
"value"
:
"2"
label
:
"销售出库"
,
value
:
"2"
,
},
{
"label"
:
"报废出库"
,
"value"
:
"3"
label
:
"报废出库"
,
value
:
"3"
,
},
{
"label"
:
"其他出库"
,
"value"
:
"4"
}
]
label
:
"其他出库"
,
value
:
"4"
,
},
],
},
{
"title"
:
"出库仓库"
,
"dataIndex"
:
"storeName"
,
"key"
:
"storeId"
,
title
:
"出库仓库"
,
dataIndex
:
"storeName"
,
key
:
"storeId"
,
options
:
{
database
:
()
=>
doFetch
({
url
:
"/ngic-auth/sysStore/selectionBox"
,
params
:
{
factoryIdList
:
[]
}
}),
params
:
{}
database
:
()
=>
doFetch
({
url
:
"/ngic-auth/sysStore/selectionBox"
,
params
:
{
factoryIdList
:
[]
},
}),
params
:
{},
},
valueType
:
"select"
,
},
{
"title"
:
"相关单号"
,
"dataIndex"
:
"businessNo"
,
"key"
:
"businessNo"
title
:
"相关单号"
,
dataIndex
:
"businessNo"
,
key
:
"businessNo"
,
},
{
"title"
:
"备注"
,
"dataIndex"
:
"remark"
,
"key"
:
"remark"
,
"search"
:
false
title
:
"备注"
,
dataIndex
:
"remark"
,
key
:
"remark"
,
search
:
false
,
},
{
"title"
:
"创建人"
,
"dataIndex"
:
"createUserName"
,
"key"
:
"createUserName"
title
:
"创建人"
,
dataIndex
:
"createUserName"
,
key
:
"createUserName"
,
},
{
"title"
:
"创建时间"
,
"dataIndex"
:
"createTime"
,
"key"
:
"createTime"
,
"valueType"
:
"dateRange"
,
title
:
"创建时间"
,
dataIndex
:
"createTime"
,
key
:
"createTime"
,
valueType
:
"dateRange"
,
formItemProps
:
{
name
:
"createTimeList"
}
name
:
"createTimeList"
,
},
},
{
"title"
:
"状态"
,
"dataIndex"
:
"statusName"
,
"key"
:
"status"
,
"valueType"
:
"select"
,
"options"
:
[
title
:
"状态"
,
dataIndex
:
"statusName"
,
key
:
"status"
,
valueType
:
"select"
,
options
:
[
{
"label"
:
"待下架"
,
"value"
:
"0"
label
:
"待下架"
,
value
:
"0"
,
},
{
"label"
:
"下架中"
,
"value"
:
"1"
}
]
label
:
"下架中"
,
value
:
"1"
,
},
],
},
{
"title"
:
"操作"
,
"valueType"
:
"option"
,
"width"
:
240
,
"render"
:
(
text
,
record
,
_
,
action
)
=>
{
title
:
"操作"
,
valueType
:
"option"
,
width
:
240
,
render
:
(
text
,
record
,
_
,
action
)
=>
{
return
[
getPrem
(
"equipmentCustomer_save"
,
action
,
'下架采集'
,
async
()
=>
{
let
extra
=
defaultFields
.
dooutside
(
record
.
id
,
record
.
storeId
);
setdrawprops
(
s
=>
({
getPrem
(
"equipmentCustomer_save"
,
action
,
"下架采集"
,
async
()
=>
{
let
extra
=
defaultFields
.
dooutside
(
record
.
id
,
record
.
storeId
);
setdrawprops
((
s
)
=>
({
...
s
,
visible
:
true
,
//查看详情 props
val
:
"detail"
,
title
:
`下架采集`
,
...
extra
,
totalPath
:
"/ngic-workmanship/wmsMaterieOutstore/getOutStoreInfoById"
,
totalPath
:
"/ngic-workmanship/wmsMaterieOutstore/getOutStoreInfoById"
,
totalParams
:
{
id
:
record
.
id
},
extra
:
null
}))
setInitialState
(
s
=>
{
return
(
{
extra
:
null
,
}));
setInitialState
((
s
)
=>
{
return
{
...
s
,
submits
:
{}
})
})
}),
getPrem
(
"equipmentCustomer_deleteById"
,
action
,
'关单'
,
null
,
{
submits
:
{},
};
});
}
),
getPrem
(
"equipmentCustomer_deleteById"
,
action
,
"关单"
,
null
,
{
title
:
"确认关单?"
,
onConfirm
:
()
=>
{
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieOutstore/close"
,
params
:
{
id
:
record
.
id
}
}).
then
(
res
=>
{
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieOutstore/close"
,
params
:
{
id
:
record
.
id
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
reload
()
}
})
reload
();
}
});
},
}),
record
.
status
==
0
&&
getPrem
(
"equipmentCustomer_deleteById"
,
action
,
'删除'
,
null
,
{
record
.
status
==
0
&&
getPrem
(
"equipmentCustomer_deleteById"
,
action
,
"删除"
,
null
,
{
title
:
"确认删除?"
,
onConfirm
:
()
=>
{
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieOutstore/deleteById"
,
params
:
{
id
:
record
.
id
}
}).
then
(
res
=>
{
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieOutstore/deleteById"
,
params
:
{
id
:
record
.
id
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
reload
()
}
})
reload
();
}
})
});
},
}),
];
},
},
];
}
}
]
}
else
{
return
[
{
"title"
:
"出库单号"
,
"dataIndex"
:
"materieOutstoreNo"
,
"key"
:
"materieOutstoreNo"
,
"render"
:
(
dom
,
record
)
=>
{
return
<
a
title
:
"出库单号"
,
dataIndex
:
"materieOutstoreNo"
,
key
:
"materieOutstoreNo"
,
render
:
(
dom
,
record
)
=>
{
return
(
<
a
onClick=
{
()
=>
{
setdrawprops
(
s
=>
({
setdrawprops
((
s
)
=>
({
...
s
,
visible
:
true
,
//查看详情 props
val
:
"detail"
,
title
:
`查看详情`
,
...
defaultFields
?.
detail
,
totalPath
:
"/ngic-workmanship/wmsMaterieOutstoreHis/getOutStoreInfoById"
,
totalParams
:
{
id
:
record
.
id
}
}))
totalPath
:
"/ngic-workmanship/wmsMaterieOutstoreHis/getOutStoreInfoById"
,
totalParams
:
{
id
:
record
.
id
},
}));
}
}
>
{
dom
}
</
a
>
}
>
{
dom
}
</
a
>
);
},
},
{
"title"
:
"出库类型"
,
"dataIndex"
:
"outstoreTypeName"
,
"key"
:
"outstoreType"
,
"valueType"
:
"select"
,
"options"
:
[
title
:
"出库类型"
,
dataIndex
:
"outstoreTypeName"
,
key
:
"outstoreType"
,
valueType
:
"select"
,
options
:
[
{
"label"
:
"生产领料出库"
,
"value"
:
"1"
label
:
"生产领料出库"
,
value
:
"1"
,
},
{
"label"
:
"销售出库"
,
"value"
:
"2"
label
:
"销售出库"
,
value
:
"2"
,
},
{
"label"
:
"报废出库"
,
"value"
:
"3"
label
:
"报废出库"
,
value
:
"3"
,
},
{
"label"
:
"其他出库"
,
"value"
:
"4"
}
]
label
:
"其他出库"
,
value
:
"4"
,
},
],
},
{
"title"
:
"出库仓库"
,
"dataIndex"
:
"storeName"
,
"key"
:
"storeId"
,
title
:
"出库仓库"
,
dataIndex
:
"storeName"
,
key
:
"storeId"
,
options
:
{
database
:
()
=>
doFetch
({
url
:
"/ngic-auth/sysStore/selectionBox"
,
params
:
{
factoryIdList
:
[]
}
}),
params
:
{}
database
:
()
=>
doFetch
({
url
:
"/ngic-auth/sysStore/selectionBox"
,
params
:
{
factoryIdList
:
[]
},
}),
params
:
{},
},
valueType
:
"select"
,
},
{
"title"
:
"相关单号"
,
"dataIndex"
:
"businessNo"
,
"key"
:
"businessNo"
title
:
"相关单号"
,
dataIndex
:
"businessNo"
,
key
:
"businessNo"
,
},
{
"title"
:
"备注"
,
"dataIndex"
:
"remark"
,
"key"
:
"remark"
,
"search"
:
false
title
:
"备注"
,
dataIndex
:
"remark"
,
key
:
"remark"
,
search
:
false
,
},
{
"title"
:
"创建人"
,
"dataIndex"
:
"createUserName"
,
"key"
:
"createUserName"
title
:
"创建人"
,
dataIndex
:
"createUserName"
,
key
:
"createUserName"
,
},
{
"title"
:
"创建时间"
,
"dataIndex"
:
"createTime"
,
"key"
:
"createTime"
,
"valueType"
:
"dateRange"
,
title
:
"创建时间"
,
dataIndex
:
"createTime"
,
key
:
"createTime"
,
valueType
:
"dateRange"
,
formItemProps
:
{
name
:
"createTimeList"
}
name
:
"createTimeList"
,
},
},
{
"title"
:
"完成时间"
,
"dataIndex"
:
"finishTime"
,
"key"
:
"finishTime"
,
"valueType"
:
"dateRange"
,
title
:
"完成时间"
,
dataIndex
:
"finishTime"
,
key
:
"finishTime"
,
valueType
:
"dateRange"
,
formItemProps
:
{
name
:
"finishTimeList"
}
name
:
"finishTimeList"
,
},
},
{
"title"
:
"状态"
,
"dataIndex"
:
"statusName"
,
"key"
:
"status"
,
"valueType"
:
"select"
,
"options"
:
[
title
:
"状态"
,
dataIndex
:
"statusName"
,
key
:
"status"
,
valueType
:
"select"
,
options
:
[
{
"label"
:
"已下架"
,
"value"
:
"2"
label
:
"已下架"
,
value
:
"2"
,
},
{
"label"
:
"已关单"
,
"value"
:
"4"
}
]
}
]
label
:
"已关单"
,
value
:
"4"
,
},
],
},
];
}
},
[
activeTabKey
])
},
[
activeTabKey
]);
const
tableprops
=
{
...
props
,
pageextra
:
activeTabKey
==
"1"
?
<
Dropdown
placement=
"bottomRight"
overlay=
{
<
Menu
pageextra
:
activeTabKey
==
"1"
?
(
<
Dropdown
placement=
"bottomRight"
overlay=
{
<
Menu
onClick=
{
(
e
)
=>
{
setdrawprops
(
s
=>
({
setdrawprops
(
(
s
)
=>
({
...
s
,
visible
:
true
,
title
:
"新增"
,
title
:
"新增"
+
itemz
[
e
.
key
]
,
fields
:
defaultFields
[
e
.
key
],
outstoreType
:
keytoval
[
e
.
key
],
val
:
"add"
,
//类型
extra
:
null
}))
extra
:
null
,
}))
;
}
}
items=
{
items
}
/>
}
>
/>
}
>
<
Button
type=
"primary"
>
新增
</
Button
>
</
Dropdown
>
:
"none"
,
</
Dropdown
>
)
:
(
"none"
),
tabList
:
[
{
tab
:
"未完成"
,
key
:
"1"
},
{
key
:
"1"
,
},
{
tab
:
"已完成"
,
key
:
"2"
}
key
:
"2"
,
},
],
activeTabKey
,
onTabChange
,
columns
,
path
:
activeTabKey
==
"1"
?
"/ngic-workmanship/wmsMaterieOutstore/queryList"
:
"/ngic-workmanship/wmsMaterieOutstoreHis/queryList"
}
path
:
activeTabKey
==
"1"
?
"/ngic-workmanship/wmsMaterieOutstore/queryList"
:
"/ngic-workmanship/wmsMaterieOutstoreHis/queryList"
,
};
return
(
<
div
>
<
AutoTable
{
...
tableprops
}
{
...
tableprops
}
actionRef=
{
actionRef
}
onRef=
{
(
node
)
=>
(
ChildRef
=
node
)
}
></
AutoTable
>
...
...
@@ -406,39 +438,120 @@ function Outstore(props) {
submitData=
{
async
(
value
)
=>
{
if
(
drawprops
.
val
==
"add"
)
{
let
newfileds
=
JSON
.
parse
(
JSON
.
stringify
(
value
));
newfileds
.
materialList
=
newfileds
?.
materialList
?.
map
(
it
=>
{
newfileds
.
materialList
=
newfileds
?.
materialList
?.
map
((
it
)
=>
{
delete
it
.
usableNum
;
delete
it
.
id
;
return
it
return
it
;
});
let
res
=
await
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieOutstore/saveOutStore"
,
params
:
{
...
newfileds
,
outstoreType
:
drawprops
.
outstoreType
},
});
let
res
=
await
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieOutstore/saveOutStore"
,
params
:
{
...
newfileds
,
outstoreType
:
drawprops
.
outstoreType
}
})
if
(
res
.
code
==
"0000"
)
{
reload
();
}
}
}
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
onChange=
{
async
(
changedValues
,
allValues
)
=>
{
for
(
let
i
in
changedValues
)
{
if
(
i
==
"storeId"
)
{
setdrawprops
(
s
=>
{
let
fields
=
s
.
fields
;
let
res
=
await
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieStockStore/selectbox/usableStock"
,
params
:
{
storeId
:
changedValues
[
"storeId"
]
},
}),
options
=
res
?.
data
?.
dataList
;
setdrawprops
((
s
)
=>
{
let
fields
=
JSON
.
parse
(
JSON
.
stringify
(
s
.
fields
));
for
(
let
i
in
fields
)
{
fields
[
i
].
value
=
allValues
[
i
];
}
fields
[
"materialList"
].
linkconfig
=
{
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieStockStore/queryStoreOne"
,
params
}),
params
:
{
"materieId"
:
"linked"
,
storeId
:
changedValues
[
i
]
},
urlchangeval
:
{
//根据url接口 改变某个value
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-workmanship/wmsMaterieStockStore/queryStoreOne"
,
params
,
}),
params
:
{
materieId
:
"linked"
,
storeId
:
changedValues
[
i
]
},
effectresult
:
{
"productionUnit"
:
"productionUnit"
,
//key 为列表更新值 value为response 返回值
"productionUnitName"
:
"productionUnitName"
,
"usableNum"
:
"usableNum"
,
"outstroeNum"
:
"outstroeNum"
}
}
}
productionUnit
:
"productionUnit"
,
//key 为列表更新值 value为response 返回值
productionUnitName
:
"productionUnitName"
,
usableNum
:
"usableNum"
,
outstroeNum
:
"outstroeNum"
,
},
},
};
fields
[
"materialList"
].
columns
=
[
{
title
:
(
<
span
>
物料编码-名称
<
b
style=
{
{
color
:
"red"
}
}
>
*
</
b
>
</
span
>
),
dataIndex
:
"materieId"
,
key
:
"materieId"
,
valueType
:
"select"
,
fieldProps
:
{
allowClear
:
false
,
showSearch
:
true
,
options
},
formItemProps
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}],
};
},
editable
:
true
,
},
{
title
:
(
<
span
>
出库数量
<
b
style=
{
{
color
:
"red"
}
}
>
*
</
b
>
</
span
>
),
dataIndex
:
"outstroeNum"
,
key
:
"outstroeNum"
,
formItemProps
:
()
=>
{
return
{
rules
:
[{
required
:
true
,
message
:
"此项为必填项"
}],
};
},
valueType
:
"digit"
,
editable
:
true
,
},
{
title
:
"可用库存"
,
dataIndex
:
"usableNum"
,
key
:
"usableNum"
,
readonly
:
"usableNum"
,
},
{
title
:
"库存单位"
,
dataIndex
:
"productionUnitName"
,
key
:
"productionUnitName"
,
readonly
:
"productionUnitName"
,
},
{
title
:
"操作"
,
valueType
:
"option"
,
width
:
70
,
render
:
(
text
,
record
,
_
,
action
)
=>
[
<
a
key=
"delete"
onClick=
{
()
=>
{}
}
>
删除
</
a
>,
],
},
];
fields
[
"materialList"
].
value
=
undefined
;
let
newfields
=
{
...
fields
,
};
return
{
...
s
,
fields
}
})
fields
:
newfields
,
};
});
}
}
}
}
...
...
src/pages/platform/Custom/index.jsx
View file @
2b7e6c2d
import
React
,
{
useState
,
useRef
,
useReducer
}
from
'react'
;
import
{
Modal
,
Button
,
Drawer
,
Tooltip
,
Popconfirm
,
message
,
Switch
}
from
'antd'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
getPrem
from
'@/utils/getPrem'
;
//权限判断fn
import
InitForm
from
'@/components/InitForm'
;
import
React
,
{
useState
,
useRef
,
useReducer
}
from
"react"
;
import
{
Modal
,
Button
,
Drawer
,
Tooltip
,
Popconfirm
,
message
,
Switch
,
}
from
"antd"
;
import
AutoTable
from
"@/components/AutoTable"
;
import
getPrem
from
"@/utils/getPrem"
;
//权限判断fn
import
InitForm
from
"@/components/InitForm"
;
import
{
useRequest
}
from
"umi"
;
import
defaultFields
from
"./fields"
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
deviceprovideDetail
,
deleteProvideCheck
}
from
"@/services/device"
;
import
{
usercusDetails
}
from
"@/utils/detailTotalCard"
;
import
Details
from
"@/components/Details"
;
import
{
useAsyncEffect
}
from
'ahooks'
;
import
tempfields
from
'@/utils/tempfields'
import
{
useAsyncEffect
}
from
"ahooks"
;
import
tempfields
from
"@/utils/tempfields"
;
const
initState
=
{
vs
:
false
,
...
...
@@ -18,12 +26,13 @@ const initState = {
iftype
:
{},
details
:
{
dataSource
:
{},
totalCard
:
[]
totalCard
:
[],
},
visible
:
false
visible
:
false
,
};
function
reducer
(
state
,
action
)
{
let
{
type
}
=
action
,
newState
=
{};
let
{
type
}
=
action
,
newState
=
{};
switch
(
type
)
{
case
"add"
:
newState
=
{
...
...
@@ -31,9 +40,9 @@ function reducer(state, action) {
vs
:
true
,
iftype
:
{
title
:
"新增客户"
,
val
:
type
val
:
type
,
},
fields
:
{
...
action
.
fields
}
fields
:
{
...
action
.
fields
},
};
break
;
case
"edit"
:
...
...
@@ -42,36 +51,38 @@ function reducer(state, action) {
vs
:
true
,
iftype
:
{
title
:
"编辑客户"
,
val
:
type
val
:
type
,
},
fields
:
{
...
action
.
fields
},
}
};
break
;
case
"cdetails"
:
let
n
=
1
,
dataSource
=
action
.
dataSource
;
let
special
=
action
?.
dataSource
?.
customerCharList
?.
map
?.(
it
=>
{
let
n
=
1
,
dataSource
=
action
.
dataSource
;
let
special
=
action
?.
dataSource
?.
customerCharList
?.
map
?.((
it
)
=>
{
n
++
;
let
key
=
n
.
toString
();
dataSource
[
key
]
=
it
?.
fieldRealValue
;
return
{
"title"
:
it
?.
fieldName
,
"key"
:
key
,
}
})
let
extraspecial
=
[{
cardTitle
:
'特殊属性'
,
itemData
:
special
}]
title
:
it
?.
fieldName
,
key
:
key
,
};
});
let
extraspecial
=
[
{
cardTitle
:
"特殊属性"
,
itemData
:
special
,
},
];
newState
=
{
...
state
,
details
:
{
dataSource
:
action
.
dataSource
,
totalCard
:
[...
usercusDetails
,...
extraspecial
]
totalCard
:
[...
usercusDetails
,
...
extraspecial
],
},
visible
:
true
}
visible
:
true
,
};
break
;
case
"close"
:
newState
=
{
...
...
@@ -80,19 +91,18 @@ function reducer(state, action) {
iftype
:
{},
details
:
{
dataSource
:
{},
totalCard
:
[]
totalCard
:
[],
},
visible
:
false
visible
:
false
,
};
break
;
}
return
newState
;
}
const
Deviceprovide
=
(
props
)
=>
{
let
actionRef
=
useRef
(),
ChildRef
=
null
;
let
actionRef
=
useRef
(),
ChildRef
=
null
;
function
reload
()
{
actionRef
?.
current
?.
reload
();
ChildRef
?.
onRefresh
();
...
...
@@ -101,95 +111,118 @@ const Deviceprovide = (props) => {
{
vs
,
fields
,
iftype
,
details
,
visible
}
=
state
,
columns
=
[
{
"title"
:
"客户编号"
,
"dataIndex"
:
"customerNo"
,
"key"
:
"customerNo"
title
:
"客户编号"
,
dataIndex
:
"customerNo"
,
key
:
"customerNo"
,
},
{
"title"
:
"客户名称"
,
"dataIndex"
:
"customerName"
,
"key"
:
"customerName"
,
title
:
"客户名称"
,
dataIndex
:
"customerName"
,
key
:
"customerName"
,
render
:
(
_
,
row
)
=>
{
return
<
div
style=
{
{
padding
:
'3px 0'
,
overflow
:
'hidden'
,
whiteSpace
:
'nowrap'
,
textOverflow
:
'ellipsis'
}
}
>
return
(
<
div
style=
{
{
padding
:
"3px 0"
,
overflow
:
"hidden"
,
whiteSpace
:
"nowrap"
,
textOverflow
:
"ellipsis"
,
}
}
>
<
Tooltip
title=
{
row
.
customerName
}
>
<
a
onClick=
{
()
=>
{
doFetch
({
url
:
"/ngic-auth/sysCustomer/query/detail"
,
params
:
{
id
:
row
.
id
}
}).
then
(
res
=>
{
<
a
onClick=
{
()
=>
{
doFetch
({
url
:
"/ngic-auth/sysCustomer/query/detail"
,
params
:
{
id
:
row
.
id
},
}).
then
((
res
)
=>
{
let
data
=
res
?.
data
?.
data
||
{};
dispatch
({
type
:
"cdetails"
,
dataSource
:
data
})
})
}
}
>
{
row
.
customerName
}
</
a
>
dispatch
({
type
:
"cdetails"
,
dataSource
:
data
});
});
}
}
>
{
row
.
customerName
}
</
a
>
</
Tooltip
>
</
div
>
}
);
},
},
{
"title"
:
"联系电话"
,
"dataIndex"
:
"telephone"
,
"key"
:
"telephone"
title
:
"联系电话"
,
dataIndex
:
"telephone"
,
key
:
"telephone"
,
},
{
"title"
:
"邮箱"
,
"dataIndex"
:
"email"
,
"key"
:
"email"
title
:
"邮箱"
,
dataIndex
:
"email"
,
key
:
"email"
,
},
{
"title"
:
"地址"
,
"dataIndex"
:
"address"
,
"key"
:
"address"
,
"search"
:
false
title
:
"地址"
,
dataIndex
:
"address"
,
key
:
"address"
,
search
:
false
,
},
{
"title"
:
"备注"
,
"dataIndex"
:
"remark"
,
"key"
:
"remark"
,
"search"
:
false
title
:
"备注"
,
dataIndex
:
"remark"
,
key
:
"remark"
,
search
:
false
,
},
{
"title"
:
"评分"
,
"dataIndex"
:
"score"
,
"key"
:
"score"
,
title
:
"评分"
,
dataIndex
:
"score"
,
key
:
"score"
,
render
:
(
_
,
row
)
=>
{
return
<
div
>
{
row
.
score
}
星
</
div
>
}
return
<
div
>
{
row
.
score
}
星
</
div
>;
},
},
{
"title"
:
"状态"
,
"dataIndex"
:
"status"
,
"key"
:
"status"
,
title
:
"状态"
,
dataIndex
:
"status"
,
key
:
"status"
,
valueType
:
"select"
,
options
:
[
{
label
:
"启用"
,
value
:
1
value
:
1
,
},
{
label
:
"关闭"
,
value
:
0
}
value
:
0
,
},
],
render
:
(
text
,
row
,
_
,
action
)
=>
{
return
<
Popconfirm
return
(
<
Popconfirm
title=
"是否开启或关闭客户?"
onConfirm=
{
()
=>
{
run
({
url
:
"/ngic-auth/sysCustomer/update/status"
,
params
:
{
id
:
row
.
id
,
status
:
row
.
status
==
1
?
0
:
1
}
})
}
}
onCancel=
{
()
=>
{
run
({
url
:
"/ngic-auth/sysCustomer/update/status"
,
params
:
{
id
:
row
.
id
,
status
:
row
.
status
==
1
?
0
:
1
},
});
}
}
onCancel=
{
()
=>
{}
}
okText=
"确定"
cancelText=
"取消"
disabled=
{
!
getPrem
(
"equipmentCustomer_updatestatus"
,
"ifs"
)
}
>
<
Switch
checked=
{
row
.
status
==
1
?
true
:
false
}
checkedChildren=
"开启"
unCheckedChildren=
"关闭"
defaultChecked=
{
false
}
/>
<
Switch
checked=
{
row
.
status
==
1
?
true
:
false
}
checkedChildren=
"开启"
unCheckedChildren=
"关闭"
defaultChecked=
{
false
}
/>
</
Popconfirm
>
);
},
},
{
title
:
'操作'
,
valueType
:
'option'
,
title
:
"操作"
,
valueType
:
"option"
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
extraAction
(
text
,
row
,
_
,
action
)
render
:
(
text
,
row
,
_
,
action
)
=>
extraAction
(
text
,
row
,
_
,
action
),
},
],
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
...
...
@@ -197,101 +230,129 @@ const Deviceprovide = (props) => {
formatResult
:
(
res
)
=>
res
,
onSuccess
:
(
result
,
params
)
=>
{
if
(
result
.
code
==
"0000"
)
{
message
.
success
(
"操作成功!"
)
message
.
success
(
"操作成功!"
);
reload
();
dispatch
({
type
:
"close"
})
}
dispatch
({
type
:
"close"
});
}
},
});
const
[
extrafields
,
setextrafields
]
=
useState
({});
const
[
subdata
,
setsubdata
]
=
useState
([]);
const
[
curitem
,
setcuritem
]
=
useState
({});
function
extraAction
(
text
,
record
,
_
,
action
)
{
return
[
getPrem
(
"equipmentCustomer_save"
,
action
,
'修改'
,
async
()
=>
{
getPrem
(
"equipmentCustomer_save"
,
action
,
"修改"
,
async
()
=>
{
await
setcuritem
({
...
record
,
key
:
"edit"
key
:
"edit"
,
});
}),
getPrem
(
"equipmentCustomer_deleteById"
,
action
,
'删除'
,
null
,
{
getPrem
(
"equipmentCustomer_deleteById"
,
action
,
"删除"
,
null
,
{
title
:
"确认删除该客户?"
,
onConfirm
:
()
=>
{
run
({
url
:
"/ngic-auth/sysCustomer/deleteById"
,
params
:
{
id
:
record
.
id
}
})
}
})
run
({
url
:
"/ngic-auth/sysCustomer/deleteById"
,
params
:
{
id
:
record
.
id
},
});
},
}),
];
};
}
let
saveData
=
(
values
,
fn
)
=>
{
let
newfields
=
JSON
.
parse
(
JSON
.
stringify
(
values
));
//新增&修改
let
difrid
=
iftype
.
val
==
"edit"
?
{
id
:
curitem
.
id
}
:
{};
let
customerUserList
=
newfields
?.
customerUserList
?.
map
(
it
=>
{
let
customerUserList
=
newfields
?.
customerUserList
?.
map
((
it
)
=>
{
delete
it
.
id
;
return
it
return
it
;
});
let
customerCharList
=
subdata
.
map
((
it
,
i
)
=>
{
let
key
=
"field"
+
i
.
toString
();
it
.
fieldRealValue
=
values
[
key
];
delete
newfields
[
key
]
return
it
})
delete
newfields
[
key
];
return
it
;
});
let
params
=
{
...
newfields
,
customerUserList
,
customerCharList
}
run
({
url
:
"/ngic-auth/sysCustomer/save"
,
params
:
{
...
params
,
...
difrid
}
})
customerCharList
,
};
run
({
url
:
"/ngic-auth/sysCustomer/save"
,
params
:
{
...
params
,
...
difrid
},
});
};
let
extrarender
=
([
<
Button
disabled=
{
!
getPrem
(
"equipmentCustomer_save"
,
"ifs"
)
}
type=
"primary"
onClick=
{
()
=>
{
let
extrarender
=
[
<
Button
disabled=
{
!
getPrem
(
"equipmentCustomer_save"
,
"ifs"
)
}
type=
"primary"
onClick=
{
async
()
=>
{
let
result
=
await
tempfields
(
"/ngic-auth/sysCustomerChar/queryCommonList"
,
{}
);
for
(
let
i
in
defaultFields
)
{
defaultFields
[
i
].
value
=
null
;
if
(
i
==
"customerUserList"
)
{
defaultFields
[
i
].
value
=
[]
defaultFields
[
i
].
value
=
[];
}
if
(
i
==
"status"
)
{
defaultFields
[
i
].
value
=
1
defaultFields
[
i
].
value
=
1
;
}
}
for
(
let
i
in
extrafields
)
{
extrafields
[
i
].
value
=
null
;
if
(
extrafields
[
i
][
"multiple"
]
==
true
)
{
extrafields
[
i
].
value
=
[]
extrafields
[
i
].
value
=
[];
}
}
dispatch
({
type
:
"add"
,
fields
:
{
...
defaultFields
,
...
extrafields
}
})
}
}
>
新增
</
Button
>
]);
dispatch
({
type
:
"add"
,
fields
:
{
...
defaultFields
,
...
result
?.
fields
},
});
}
}
>
新增
</
Button
>,
];
useAsyncEffect
(
async
()
=>
{
let
result
=
await
tempfields
(
"/ngic-auth/sysCustomerChar/queryCommonList"
,
{
id
:
curitem
.
id
})
await
setextrafields
(
result
?.
fields
)
let
result
=
await
tempfields
(
"/ngic-auth/sysCustomerChar/queryCommonList"
,
{
id
:
curitem
.
id
}
);
await
setextrafields
(
result
?.
fields
);
await
setsubdata
(
result
?.
data
);
if
(
curitem
.
key
==
"edit"
)
{
doFetch
({
url
:
"/ngic-auth/sysCustomer/query/detail"
,
params
:
{
id
:
curitem
.
id
}
}).
then
(
res
=>
{
doFetch
({
url
:
"/ngic-auth/sysCustomer/query/detail"
,
params
:
{
id
:
curitem
.
id
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
let
data
=
res
?.
data
?.
data
||
{};
for
(
let
i
in
defaultFields
)
{
defaultFields
[
i
].
value
=
data
[
i
];
}
dispatch
({
type
:
"edit"
,
fields
:
{
...
defaultFields
,
...
result
?.
fields
}
})
dispatch
({
type
:
"edit"
,
fields
:
{
...
defaultFields
,
...
result
?.
fields
},
});
}
})
});
}
},
[
curitem
])
},
[
curitem
]);
return
<
div
>
return
(
<
div
>
<
AutoTable
pagetitle=
{
props
.
route
.
name
}
//页面标题
pageextra=
{
extrarender
}
//页面操作 新增or批量删除
columns=
{
columns
}
path=
"/ngic-auth/sysCustomer/queryList"
actionRef=
{
actionRef
}
onRef=
{
node
=>
ChildRef
=
node
}
onRef=
{
(
node
)
=>
(
ChildRef
=
node
)
}
></
AutoTable
>
<
Modal
...
...
@@ -306,16 +367,13 @@ const Deviceprovide = (props) => {
<
InitForm
fields=
{
fields
}
submitData=
{
(
values
)
=>
{
saveData
(
values
)
saveData
(
values
);
}
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
//联动操作
}
}
submitting=
{
loading
||
!
vs
}
>
</
InitForm
>
submitting=
{
loading
||
!
vs
}
></
InitForm
>
</
Modal
>
<
Details
title=
"客户详情"
...
...
@@ -323,13 +381,12 @@ const Deviceprovide = (props) => {
visible=
{
visible
}
onClose=
{
()
=>
dispatch
({
type
:
"close"
})
}
destroyOnClose=
{
true
}
afterVisibleChange=
{
(
v
)
=>
{
}
}
afterVisibleChange=
{
(
v
)
=>
{}
}
width=
"100%"
className=
"drawerDetails"
{
...
details
}
></
Details
>
</
div
>
}
);
};
export
default
Deviceprovide
;
src/pages/platform/Provide/index.jsx
View file @
2b7e6c2d
import
React
,
{
useState
,
useRef
,
useReducer
}
from
'react'
;
import
{
Modal
,
Button
,
Drawer
,
Tooltip
,
Popconfirm
,
message
,
Switch
}
from
'antd'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
getPrem
from
'@/utils/getPrem'
;
//权限判断fn
import
InitForm
from
'@/components/InitForm'
;
import
React
,
{
useState
,
useRef
,
useReducer
}
from
"react"
;
import
{
Modal
,
Button
,
Drawer
,
Tooltip
,
Popconfirm
,
message
,
Switch
,
}
from
"antd"
;
import
AutoTable
from
"@/components/AutoTable"
;
import
getPrem
from
"@/utils/getPrem"
;
//权限判断fn
import
InitForm
from
"@/components/InitForm"
;
import
{
useRequest
}
from
"umi"
;
import
defaultFields
from
"./fields"
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
deviceprovideDetail
,
deleteProvideCheck
}
from
"@/services/device"
;
import
{
usercusDetails
}
from
"@/utils/detailTotalCard"
;
import
Details
from
"@/components/Details"
;
import
{
useAsyncEffect
}
from
'ahooks'
;
import
tempfields
from
'@/utils/tempfields'
import
{
useAsyncEffect
}
from
"ahooks"
;
import
tempfields
from
"@/utils/tempfields"
;
const
initState
=
{
vs
:
false
,
...
...
@@ -19,12 +27,13 @@ const initState = {
curitem
:
{},
details
:
{
dataSource
:
{},
totalCard
:
[]
totalCard
:
[],
},
visible
:
false
visible
:
false
,
};
function
reducer
(
state
,
action
)
{
let
{
type
}
=
action
,
newState
=
{};
let
{
type
}
=
action
,
newState
=
{};
switch
(
type
)
{
case
"add"
:
newState
=
{
...
...
@@ -32,9 +41,9 @@ function reducer(state, action) {
vs
:
true
,
iftype
:
{
title
:
"新增供应商"
,
val
:
type
val
:
type
,
},
fields
:
{
...
action
.
fields
}
fields
:
{
...
action
.
fields
},
};
break
;
case
"edit"
:
...
...
@@ -43,37 +52,39 @@ function reducer(state, action) {
vs
:
true
,
iftype
:
{
title
:
"编辑供应商"
,
val
:
type
val
:
type
,
},
fields
:
{
...
action
.
fields
},
curitem
:
action
.
curitem
}
curitem
:
action
.
curitem
,
};
break
;
case
"cdetails"
:
let
n
=
1
,
dataSource
=
action
.
dataSource
;
let
special
=
action
?.
dataSource
?.
supplierCharList
?.
map
?.(
it
=>
{
let
n
=
1
,
dataSource
=
action
.
dataSource
;
let
special
=
action
?.
dataSource
?.
supplierCharList
?.
map
?.((
it
)
=>
{
n
++
;
let
key
=
n
.
toString
();
dataSource
[
key
]
=
it
?.
fieldRealValue
;
return
{
"title"
:
it
?.
fieldName
,
"key"
:
key
,
}
})
let
extraspecial
=
[{
cardTitle
:
'特殊属性'
,
itemData
:
special
}]
title
:
it
?.
fieldName
,
key
:
key
,
};
});
let
extraspecial
=
[
{
cardTitle
:
"特殊属性"
,
itemData
:
special
,
},
];
newState
=
{
...
state
,
details
:
{
dataSource
:
action
.
dataSource
,
totalCard
:
[...
usercusDetails
,
...
extraspecial
]
totalCard
:
[...
usercusDetails
,
...
extraspecial
],
},
visible
:
true
}
visible
:
true
,
};
break
;
case
"close"
:
newState
=
{
...
...
@@ -83,19 +94,18 @@ function reducer(state, action) {
curitem
:
{},
details
:
{
dataSource
:
{},
totalCard
:
[]
totalCard
:
[],
},
visible
:
false
visible
:
false
,
};
break
;
}
return
newState
;
}
const
Deviceprovide
=
(
props
)
=>
{
let
actionRef
=
useRef
(),
ChildRef
=
null
;
let
actionRef
=
useRef
(),
ChildRef
=
null
;
function
reload
()
{
actionRef
?.
current
?.
reload
();
ChildRef
?.
onRefresh
();
...
...
@@ -104,95 +114,118 @@ const Deviceprovide = (props) => {
{
vs
,
fields
,
iftype
,
details
,
visible
}
=
state
,
columns
=
[
{
"title"
:
"供应商编号"
,
"dataIndex"
:
"supplierNo"
,
"key"
:
"supplierNo"
title
:
"供应商编号"
,
dataIndex
:
"supplierNo"
,
key
:
"supplierNo"
,
},
{
"title"
:
"供应商名称"
,
"dataIndex"
:
"supplierName"
,
"key"
:
"supplierName"
,
title
:
"供应商名称"
,
dataIndex
:
"supplierName"
,
key
:
"supplierName"
,
render
:
(
_
,
row
)
=>
{
return
<
div
style=
{
{
padding
:
'3px 0'
,
overflow
:
'hidden'
,
whiteSpace
:
'nowrap'
,
textOverflow
:
'ellipsis'
}
}
>
return
(
<
div
style=
{
{
padding
:
"3px 0"
,
overflow
:
"hidden"
,
whiteSpace
:
"nowrap"
,
textOverflow
:
"ellipsis"
,
}
}
>
<
Tooltip
title=
{
row
.
supplierName
}
>
<
a
onClick=
{
()
=>
{
deviceprovideDetail
({
id
:
row
.
id
}).
then
(
res
=>
{
<
a
onClick=
{
()
=>
{
deviceprovideDetail
({
id
:
row
.
id
}).
then
((
res
)
=>
{
let
data
=
res
?.
data
?.
data
||
{};
dispatch
({
type
:
"cdetails"
,
dataSource
:
data
})
})
}
}
>
{
row
.
supplierName
}
</
a
>
dispatch
({
type
:
"cdetails"
,
dataSource
:
data
});
});
}
}
>
{
row
.
supplierName
}
</
a
>
</
Tooltip
>
</
div
>
}
);
},
},
{
"title"
:
"联系电话"
,
"dataIndex"
:
"telephone"
,
"key"
:
"telephone"
title
:
"联系电话"
,
dataIndex
:
"telephone"
,
key
:
"telephone"
,
},
{
"title"
:
"邮箱"
,
"dataIndex"
:
"email"
,
"key"
:
"email"
title
:
"邮箱"
,
dataIndex
:
"email"
,
key
:
"email"
,
},
{
"title"
:
"地址"
,
"dataIndex"
:
"address"
,
"key"
:
"address"
,
"search"
:
false
title
:
"地址"
,
dataIndex
:
"address"
,
key
:
"address"
,
search
:
false
,
},
{
"title"
:
"备注"
,
"dataIndex"
:
"remark"
,
"key"
:
"remark"
,
"search"
:
false
title
:
"备注"
,
dataIndex
:
"remark"
,
key
:
"remark"
,
search
:
false
,
},
{
"title"
:
"评分"
,
"dataIndex"
:
"score"
,
"key"
:
"score"
,
title
:
"评分"
,
dataIndex
:
"score"
,
key
:
"score"
,
render
:
(
_
,
row
)
=>
{
return
<
div
>
{
row
.
score
}
星
</
div
>
}
return
<
div
>
{
row
.
score
}
星
</
div
>;
},
},
{
"title"
:
"状态"
,
"dataIndex"
:
"status"
,
"key"
:
"status"
,
title
:
"状态"
,
dataIndex
:
"status"
,
key
:
"status"
,
valueType
:
"select"
,
options
:
[
{
label
:
"启用"
,
value
:
1
value
:
1
,
},
{
label
:
"关闭"
,
value
:
0
}
value
:
0
,
},
],
render
:
(
text
,
row
,
_
,
action
)
=>
{
return
<
Popconfirm
return
(
<
Popconfirm
title=
"是否开启或关闭供应商?"
onConfirm=
{
()
=>
{
run
({
url
:
"/ngic-auth/sysSupplier/update/status"
,
params
:
{
id
:
row
.
id
,
status
:
row
.
status
==
1
?
0
:
1
}
})
}
}
onCancel=
{
()
=>
{
run
({
url
:
"/ngic-auth/sysSupplier/update/status"
,
params
:
{
id
:
row
.
id
,
status
:
row
.
status
==
1
?
0
:
1
},
});
}
}
onCancel=
{
()
=>
{}
}
okText=
"确定"
cancelText=
"取消"
disabled=
{
!
getPrem
(
"equipmentSupplier_updatestatus"
,
"ifs"
)
||
row
.
sourceType
==
1
}
disabled=
{
!
getPrem
(
"equipmentSupplier_updatestatus"
,
"ifs"
)
||
row
.
sourceType
==
1
}
>
<
Switch
checked=
{
row
.
status
==
1
?
true
:
false
}
checkedChildren=
"开启"
unCheckedChildren=
"关闭"
defaultChecked=
{
false
}
/>
<
Switch
checked=
{
row
.
status
==
1
?
true
:
false
}
checkedChildren=
"开启"
unCheckedChildren=
"关闭"
defaultChecked=
{
false
}
/>
</
Popconfirm
>
);
},
},
{
title
:
'操作'
,
valueType
:
'option'
,
title
:
"操作"
,
valueType
:
"option"
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
extraAction
(
text
,
row
,
_
,
action
)
render
:
(
text
,
row
,
_
,
action
)
=>
extraAction
(
text
,
row
,
_
,
action
),
},
],
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
...
...
@@ -200,79 +233,106 @@ const Deviceprovide = (props) => {
formatResult
:
(
res
)
=>
res
,
onSuccess
:
(
result
,
params
)
=>
{
if
(
result
.
code
==
"0000"
)
{
message
.
success
(
"操作成功!"
)
message
.
success
(
"操作成功!"
);
reload
();
dispatch
({
type
:
"close"
})
}
dispatch
({
type
:
"close"
});
}
},
});
const
[
extrafields
,
setextrafields
]
=
useState
({});
const
[
subdata
,
setsubdata
]
=
useState
([]);
const
[
curitem
,
setcuritem
]
=
useState
({});
function
extraAction
(
text
,
record
,
_
,
action
)
{
return
[
getPrem
(
"equipmentSupplier_save"
,
action
,
'修改'
,
async
()
=>
{
getPrem
(
"equipmentSupplier_save"
,
action
,
"修改"
,
async
()
=>
{
await
setcuritem
({
...
record
,
key
:
"edit"
key
:
"edit"
,
});
}),
record
.
sourceType
!=
1
&&
getPrem
(
"equipmentSupplier_deleteById"
,
action
,
'删除'
,
null
,
{
record
.
sourceType
!=
1
&&
getPrem
(
"equipmentSupplier_deleteById"
,
action
,
"删除"
,
null
,
{
title
:
"确认删除该供应商?"
,
onConfirm
:
()
=>
{
run
({
url
:
"/ngic-auth/sysSupplier/deleteById"
,
params
:
{
id
:
record
.
id
}
})
}
})
run
({
url
:
"/ngic-auth/sysSupplier/deleteById"
,
params
:
{
id
:
record
.
id
},
});
},
}),
];
};
}
let
saveData
=
(
values
,
fn
)
=>
{
let
newfields
=
JSON
.
parse
(
JSON
.
stringify
(
values
));
//新增&修改
let
difrid
=
iftype
.
val
==
"edit"
?
{
id
:
curitem
.
id
}
:
{};
let
supplierUserList
=
newfields
?.
supplierUserList
?.
map
(
it
=>
{
let
supplierUserList
=
newfields
?.
supplierUserList
?.
map
((
it
)
=>
{
delete
it
.
id
;
return
it
return
it
;
});
let
supplierCharList
=
subdata
.
map
((
it
,
i
)
=>
{
let
key
=
"field"
+
i
.
toString
();
it
.
fieldRealValue
=
values
[
key
];
delete
newfields
[
key
]
return
it
})
delete
newfields
[
key
];
return
it
;
});
let
params
=
{
...
newfields
,
supplierUserList
,
supplierCharList
}
run
({
url
:
"/ngic-auth/sysSupplier/save"
,
params
:
{
...
params
,
...
difrid
}
})
supplierCharList
,
};
let
extrarender
=
([
<
Button
disabled=
{
!
getPrem
(
"equipmentSupplier_save"
,
"ifs"
)
}
type=
"primary"
onClick=
{
()
=>
{
run
({
url
:
"/ngic-auth/sysSupplier/save"
,
params
:
{
...
params
,
...
difrid
},
});
};
let
extrarender
=
[
<
Button
disabled=
{
!
getPrem
(
"equipmentSupplier_save"
,
"ifs"
)
}
type=
"primary"
onClick=
{
async
()
=>
{
let
result
=
await
tempfields
(
"/ngic-auth/sysSupplierChar/queryCommonList"
,
{}
);
for
(
let
i
in
defaultFields
)
{
defaultFields
[
i
].
value
=
null
;
defaultFields
[
i
].
disabled
=
false
;
if
(
i
==
"supplierUserList"
)
{
defaultFields
[
i
].
value
=
[]
defaultFields
[
i
].
value
=
[];
}
if
(
i
==
"status"
)
{
defaultFields
[
i
].
value
=
1
defaultFields
[
i
].
value
=
1
;
}
}
for
(
let
i
in
extrafields
)
{
extrafields
[
i
].
value
=
null
;
if
(
extrafields
[
i
][
"multiple"
]
==
true
)
{
extrafields
[
i
].
value
=
[]
extrafields
[
i
].
value
=
[];
}
}
dispatch
({
type
:
"add"
,
fields
:
{
...
defaultFields
,
...
extrafields
}
})
}
}
>
新增
</
Button
>
]);
dispatch
({
type
:
"add"
,
fields
:
{
...
defaultFields
,
...
result
?.
fields
},
});
}
}
>
新增
</
Button
>,
];
useAsyncEffect
(
async
()
=>
{
let
result
=
await
tempfields
(
"/ngic-auth/sysSupplierChar/queryCommonList"
,
{
id
:
curitem
.
id
})
await
setextrafields
(
result
?.
fields
)
let
result
=
await
tempfields
(
"/ngic-auth/sysSupplierChar/queryCommonList"
,
{
id
:
curitem
.
id
}
);
await
setextrafields
(
result
?.
fields
);
await
setsubdata
(
result
?.
data
);
if
(
curitem
.
key
==
"edit"
)
{
doFetch
({
url
:
"/ngic-auth/sysSupplier/query/detail"
,
params
:
{
id
:
curitem
.
id
}
}).
then
(
res
=>
{
doFetch
({
url
:
"/ngic-auth/sysSupplier/query/detail"
,
params
:
{
id
:
curitem
.
id
},
}).
then
((
res
)
=>
{
if
(
res
.
code
==
"0000"
)
{
let
data
=
res
?.
data
?.
data
||
{};
for
(
let
i
in
defaultFields
)
{
...
...
@@ -283,19 +343,24 @@ const Deviceprovide = (props) => {
defaultFields
[
i
].
disabled
=
false
;
}
}
dispatch
({
type
:
"edit"
,
fields
:
{
...
defaultFields
,
...
result
?.
fields
}
})
dispatch
({
type
:
"edit"
,
fields
:
{
...
defaultFields
,
...
result
?.
fields
},
});
}
})
});
}
},
[
curitem
])
return
<
div
>
},
[
curitem
]);
return
(
<
div
>
<
AutoTable
pagetitle=
{
props
.
route
.
name
}
//页面标题
pageextra=
{
extrarender
}
//页面操作 新增or批量删除
columns=
{
columns
}
path=
"/ngic-auth/sysSupplier/queryList"
actionRef=
{
actionRef
}
onRef=
{
node
=>
ChildRef
=
node
}
onRef=
{
(
node
)
=>
(
ChildRef
=
node
)
}
></
AutoTable
>
<
Modal
...
...
@@ -310,16 +375,13 @@ const Deviceprovide = (props) => {
<
InitForm
fields=
{
fields
}
submitData=
{
(
values
)
=>
{
saveData
(
values
)
saveData
(
values
);
}
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
//联动操作
}
}
submitting=
{
loading
||
!
vs
}
>
</
InitForm
>
submitting=
{
loading
||
!
vs
}
></
InitForm
>
</
Modal
>
<
Details
title=
"供应商详情"
...
...
@@ -327,14 +389,12 @@ const Deviceprovide = (props) => {
visible=
{
visible
}
onClose=
{
()
=>
dispatch
({
type
:
"close"
})
}
destroyOnClose=
{
true
}
afterVisibleChange=
{
(
v
)
=>
{
}
}
afterVisibleChange=
{
(
v
)
=>
{}
}
width=
"100%"
className=
"drawerDetails"
{
...
details
}
>
</
Details
>
{
...
details
}
></
Details
>
</
div
>
}
);
};
export
default
Deviceprovide
;
src/pages/platform/Sendset/Formpage.jsx
View file @
2b7e6c2d
import
React
,
{
memo
,
useEffect
,
useRef
,
useState
,
useReducer
}
from
'react'
;
import
{
Image
,
Divider
,
Menu
,
Dropdown
,
Button
,
Modal
,
Row
,
Col
,
Tooltip
,
Drawer
,
Form
,
Input
,
message
,
Typography
}
from
'antd'
;
import
React
,
{
memo
,
useEffect
,
useRef
,
useState
,
useReducer
}
from
"react"
;
import
{
Image
,
Divider
,
Menu
,
Dropdown
,
Button
,
Modal
,
Row
,
Col
,
Tooltip
,
Drawer
,
Form
,
Input
,
message
,
Typography
,
}
from
"antd"
;
import
{
connect
,
useRequest
}
from
"umi"
;
import
AutoTable
from
'@/components/AutoTable'
;
import
getPrem
from
'@/utils/getPrem'
;
//权限判断fn
import
InitForm
from
'@/components/InitForm'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
AutoTable
from
"@/components/AutoTable"
;
import
getPrem
from
"@/utils/getPrem"
;
//权限判断fn
import
InitForm
from
"@/components/InitForm"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
tableField
}
from
"./fields"
;
import
moment
from
"moment"
;
import
{
factorySelect
,
factory
,
allDepartment
,
allShop
,
depart
,
selectionBoxAll
,
roleList
,
currentUserList
}
from
"@/services/system"
;
import
{
factorySelect
,
zuzhi
,
allDepartment
,
allShop
,
depart
,
selectionBoxAll
,
roleList
,
currentUserList
,
}
from
"@/services/system"
;
const
{
TextArea
}
=
Input
,
{
Paragraph
}
=
Typography
;
...
...
@@ -21,77 +45,77 @@ const initState = {
formFields
:
{},
tableLoading
:
false
,
variableVisible
:
false
,
variableExtraparams
:
""
},
variableExtraparams
:
""
,
},
sendToArr
=
[
{
"label"
:
"可操作人员"
,
"value"
:
1
label
:
"可操作人员"
,
value
:
1
,
},
{
"label"
:
"创建人"
,
"value"
:
2
label
:
"创建人"
,
value
:
2
,
},
{
"label"
:
"(上个通知人员)上级领导"
,
"value"
:
3
label
:
"(上个通知人员)上级领导"
,
value
:
3
,
},
{
"label"
:
"选择角色"
,
"value"
:
4
label
:
"选择角色"
,
value
:
4
,
},
{
"label"
:
"选择人员"
,
"value"
:
5
}
label
:
"选择人员"
,
value
:
5
,
},
],
unitArr
=
[
{
"label"
:
"分钟"
,
"value"
:
1
label
:
"分钟"
,
value
:
1
,
},
{
"label"
:
"小时"
,
"value"
:
2
label
:
"小时"
,
value
:
2
,
},
{
"label"
:
"天"
,
"value"
:
3
}
label
:
"天"
,
value
:
3
,
},
],
sendProcessArr
=
[
{
label
:
"一级通知"
,
value
:
1
value
:
1
,
},
{
label
:
"二级通知"
,
value
:
2
value
:
2
,
},
{
label
:
"三级通知"
,
value
:
3
value
:
3
,
},
{
label
:
"四级通知"
,
value
:
4
value
:
4
,
},
{
label
:
"五级通知"
,
value
:
5
value
:
5
,
},
{
label
:
"六级通知"
,
value
:
6
value
:
6
,
},
{
label
:
"七级通知"
,
value
:
7
value
:
7
,
},
{
label
:
"八级通知"
,
value
:
8
}
value
:
8
,
},
];
function
reducer
(
state
,
action
)
{
if
(
action
.
type
==
"add"
)
{
...
...
@@ -102,9 +126,9 @@ function reducer(state, action) {
iftype
:
{
val
:
"add"
,
title
:
"新增基础设置"
,
id
:
""
}
}
id
:
""
,
},
};
}
else
if
(
action
.
type
==
"edit"
)
{
return
{
...
state
,
...
...
@@ -113,58 +137,58 @@ function reducer(state, action) {
iftype
:
{
val
:
"edit"
,
title
:
"修改基础设置"
,
id
:
action
.
curitem
.
id
}
}
id
:
action
.
curitem
.
id
,
},
};
}
else
if
(
action
.
type
==
"changeHideTitle"
)
{
return
{
...
state
,
hidesTitle
:
action
.
hidesTitle
}
hidesTitle
:
action
.
hidesTitle
,
};
}
else
if
(
action
.
type
==
"changeHideContent"
)
{
return
{
...
state
,
hidesContent
:
action
.
hidesContent
}
hidesContent
:
action
.
hidesContent
,
};
}
else
if
(
action
.
type
==
"changeFormFields"
)
{
return
{
...
state
,
formFields
:
{
...
action
.
formFields
}
}
formFields
:
{
...
action
.
formFields
},
};
}
else
if
(
action
.
type
==
"start"
)
{
return
{
...
state
,
formFields
:
{
...
action
.
formFields
},
tableData
:
[...
action
.
tableData
]
}
tableData
:
[...
action
.
tableData
],
};
}
else
if
(
action
.
type
==
"changeTableFields"
)
{
return
{
...
state
,
tableFields
:
{
...
action
.
tableFields
}
}
tableFields
:
{
...
action
.
tableFields
},
};
}
else
if
(
action
.
type
==
"changeTableData"
)
{
return
{
...
state
,
tableData
:
[...
action
.
tableData
],
vs
:
false
,
tableLoading
:
false
}
tableLoading
:
false
,
};
}
else
if
(
action
.
type
==
"changeLoading"
)
{
return
{
...
state
,
tableLoading
:
true
}
tableLoading
:
true
,
};
}
else
if
(
action
.
type
==
"changeShown"
)
{
return
{
...
state
,
shown
:
action
.
shown
}
shown
:
action
.
shown
,
};
}
else
if
(
action
.
type
==
"openVariable"
)
{
return
{
...
state
,
variableVisible
:
true
,
variableExtraparams
:
action
.
variableExtraparams
}
variableExtraparams
:
action
.
variableExtraparams
,
};
}
else
if
(
action
.
type
==
"close"
)
{
return
{
...
state
,
...
...
@@ -172,41 +196,49 @@ function reducer(state, action) {
iftype
:
{},
tableFields
:
{},
variableVisible
:
false
,
variableExtraparams
:
""
}
variableExtraparams
:
""
,
};
}
}
;
}
const
Variable
=
(
props
)
=>
{
const
{
businessMsgSceneId
,
dispatch
}
=
props
;
return
<
div
>
return
(
<
div
>
<
AutoTable
withCard=
{
false
}
columns=
{
[
{
"title"
:
"变量名"
,
"dataIndex"
:
"variableName"
,
"key"
:
"variableName"
,
"width"
:
120
title
:
"变量名"
,
dataIndex
:
"variableName"
,
key
:
"variableName"
,
width
:
120
,
},
{
"title"
:
"变量代码"
,
"dataIndex"
:
"variableCode"
,
"key"
:
"variableCode"
,
"search"
:
false
title
:
"变量代码"
,
dataIndex
:
"variableCode"
,
key
:
"variableCode"
,
search
:
false
,
},
{
"title"
:
"复制"
,
"valueType"
:
"option"
,
"search"
:
false
,
title
:
"复制"
,
valueType
:
"option"
,
search
:
false
,
render
:
(
_
,
row
)
=>
{
return
<
Paragraph
copyable=
{
{
text
:
row
.
variableCode
,
onCopy
:
()
=>
{
dispatch
({
type
:
"close"
})
}
}
}
>
复制
</
Paragraph
>
}
}
return
(
<
Paragraph
copyable=
{
{
text
:
row
.
variableCode
,
onCopy
:
()
=>
{
dispatch
({
type
:
"close"
});
},
}
}
>
复制
</
Paragraph
>
);
},
},
]
}
bordered=
{
false
}
path=
"/ngic-base-business/paBusinessMsgSceneVariable/queryPageBySceneId"
...
...
@@ -214,10 +246,12 @@ const Variable = (props) => {
x=
{
"100%"
}
></
AutoTable
>
</
div
>
}
);
};
const
Formpage
=
(
props
)
=>
{
const
{
rowMessage
,
reset
,
iftypeParent
}
=
props
;
let
actionRef
=
useRef
(),
ChildRef
=
null
;
let
actionRef
=
useRef
(),
ChildRef
=
null
;
function
reload
()
{
actionRef
?.
current
?.
reload
();
ChildRef
?.
onRefresh
();
...
...
@@ -235,83 +269,102 @@ const Formpage = (props) => {
fields
[
i
].
value
=
rowMessage
[
i
];
if
(
i
==
"sendMethodType"
)
{
showTitleorContent
(
rowMessage
[
i
]);
form
.
setFieldsValue
({
"sendTitle"
:
rowMessage
.
sendTitle
,
"sendContent"
:
rowMessage
.
sendContent
})
form
.
setFieldsValue
({
sendTitle
:
rowMessage
.
sendTitle
,
sendContent
:
rowMessage
.
sendContent
,
});
}
if
(
i
==
"fieldId"
&&
rowMessage
[
"fitField"
]
==
1
)
{
fields
[
i
].
hides
=
true
fields
[
i
].
hides
=
true
;
}
else
if
(
i
==
"fieldId"
&&
rowMessage
[
"fitField"
]
!=
1
)
{
fields
[
i
].
hides
=
false
fields
[
i
].
hides
=
false
;
fields
[
i
].
options
=
{
database
,
params
:
{}
}
params
:
{},
};
}
}
}
dispatch
({
type
:
"start"
,
formFields
:
{
...
fields
},
tableData
:
iftypeParent
.
val
==
"add"
?
[]
:
rowMessage
?.
detailList
});
},
[
fields
])
dispatch
({
type
:
"start"
,
formFields
:
{
...
fields
},
tableData
:
iftypeParent
.
val
==
"add"
?
[]
:
rowMessage
?.
detailList
,
});
},
[
fields
]);
const
{
fields
}
=
props
,
[
form
]
=
Form
.
useForm
(),
[
forms
]
=
Form
.
useForm
(),
[
tableFormRef
]
=
Form
.
useForm
(),
[
state
,
dispatch
]
=
useReducer
(
reducer
,
initState
),
{
vs
,
tableFields
,
iftype
,
tableData
,
hidesTitle
,
hidesContent
,
formFields
,
tableLoading
,
variableVisible
,
shown
,
variableExtraparams
}
=
state
,
{
vs
,
tableFields
,
iftype
,
tableData
,
hidesTitle
,
hidesContent
,
formFields
,
tableLoading
,
variableVisible
,
shown
,
variableExtraparams
,
}
=
state
,
columns
=
[
{
"title"
:
"推送流程"
,
"dataIndex"
:
"sendProcessName"
,
"key"
:
"sendProcessName"
,
"search"
:
false
title
:
"推送流程"
,
dataIndex
:
"sendProcessName"
,
key
:
"sendProcessName"
,
search
:
false
,
},
{
"title"
:
"推送对象"
,
"dataIndex"
:
"sendToName"
,
"key"
:
"sendToName"
,
"search"
:
false
title
:
"推送对象"
,
dataIndex
:
"sendToName"
,
key
:
"sendToName"
,
search
:
false
,
},
{
"title"
:
"选择对象"
,
"dataIndex"
:
"targetNames"
,
"key"
:
"targetNames"
,
"search"
:
false
title
:
"选择对象"
,
dataIndex
:
"targetNames"
,
key
:
"targetNames"
,
search
:
false
,
},
{
"title"
:
"初始触发时长"
,
"dataIndex"
:
"initialTime"
,
"key"
:
"initialTime"
,
"search"
:
false
title
:
"初始触发时长"
,
dataIndex
:
"initialTime"
,
key
:
"initialTime"
,
search
:
false
,
},
{
"title"
:
"初始触发时长单位"
,
"dataIndex"
:
"initialUnitName"
,
"key"
:
"initialUnitName"
,
"search"
:
false
title
:
"初始触发时长单位"
,
dataIndex
:
"initialUnitName"
,
key
:
"initialUnitName"
,
search
:
false
,
},
{
"title"
:
"间隔时长"
,
"dataIndex"
:
"intervalTime"
,
"key"
:
"intervalTime"
,
"search"
:
false
title
:
"间隔时长"
,
dataIndex
:
"intervalTime"
,
key
:
"intervalTime"
,
search
:
false
,
},
{
"title"
:
"间隔时长单位"
,
"dataIndex"
:
"intervalUnitName"
,
"key"
:
"intervalUnitName"
,
"search"
:
false
title
:
"间隔时长单位"
,
dataIndex
:
"intervalUnitName"
,
key
:
"intervalUnitName"
,
search
:
false
,
},
{
"title"
:
"触发次数"
,
"dataIndex"
:
"sendNum"
,
"key"
:
"sendNum"
,
"search"
:
false
title
:
"触发次数"
,
dataIndex
:
"sendNum"
,
key
:
"sendNum"
,
search
:
false
,
},
{
title
:
'操作'
,
valueType
:
'option'
,
title
:
"操作"
,
valueType
:
"option"
,
width
:
150
,
render
:
(
text
,
row
,
_
,
action
)
=>
extraAction
(
text
,
row
,
_
,
action
)
}
render
:
(
text
,
row
,
_
,
action
)
=>
extraAction
(
text
,
row
,
_
,
action
),
},
],
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
manual
:
true
,
...
...
@@ -320,110 +373,146 @@ const Formpage = (props) => {
if
(
result
.
code
==
"0000"
)
{
reset
&&
reset
();
}
}
},
});
let
extrarender
=
([
<
Button
size=
{
"middle"
}
type=
"primary"
onClick=
{
()
=>
{
let
extrarender
=
[
<
Button
size=
{
"middle"
}
type=
"primary"
onClick=
{
()
=>
{
for
(
let
i
in
tableField
)
{
tableField
[
i
].
value
=
null
;
if
(
i
==
"targetIdList"
)
{
tableField
[
i
].
hides
=
true
tableField
[
i
].
value
=
[]
tableField
[
i
].
hides
=
true
;
tableField
[
i
].
value
=
[];
}
if
(
i
==
"initialTime"
)
{
tableField
[
i
].
value
=
0
tableField
[
i
].
value
=
0
;
}
if
(
i
==
"intervalTime"
)
{
tableField
[
i
].
value
=
1
tableField
[
i
].
value
=
1
;
}
if
(
i
==
"sendNum"
)
{
tableField
[
i
].
value
=
1
tableField
[
i
].
value
=
1
;
}
}
dispatch
({
type
:
"add"
,
tableFields
:
tableField
});
}
}
>
新增
</
Button
>
]);
}
}
>
新增
</
Button
>,
];
function
extraAction
(
text
,
record
,
_
,
action
)
{
return
(
<
div
>
{
getPrem
(
true
,
null
,
"修改"
,
()
=>
{
{
getPrem
(
true
,
null
,
"修改"
,
()
=>
{
for
(
let
j
in
tableField
)
{
tableField
[
j
].
value
=
record
[
j
];
if
(
j
==
"targetIdList"
)
{
if
(
record
.
sendTo
!=
4
&&
record
.
sendTo
!=
5
)
{
tableField
[
j
].
hides
=
true
tableField
[
j
].
hides
=
true
;
}
else
{
let
database
=
getformdatabase
(
record
.
sendTo
)
tableField
[
j
].
hides
=
false
let
database
=
getformdatabase
(
record
.
sendTo
);
tableField
[
j
].
hides
=
false
;
tableField
[
j
].
options
=
{
database
,
params
:
{}
}
}
params
:
{},
};
}
dispatch
({
type
:
"edit"
,
tableFields
:
tableField
,
curitem
:
record
});
}
})
dispatch
({
type
:
"edit"
,
tableFields
:
tableField
,
curitem
:
record
,
});
}
})
}
<
Divider
type=
"vertical"
/>
{
getPrem
(
true
,
"red"
,
"删除"
,
null
,
{
{
getPrem
(
true
,
"red"
,
"删除"
,
null
,
{
title
:
"确认删除该基础配置?"
,
onConfirm
:
()
=>
{
let
newData
=
tableData
.
filter
(
it
=>
it
.
id
!=
record
.
id
);
let
newData
=
tableData
.
filter
((
it
)
=>
it
.
id
!=
record
.
id
);
dispatch
({
type
:
"changeTableData"
,
tableData
:
newData
});
}
})
}
},
})
}
</
div
>
);
}
let
saveData
=
(
values
,
fn
)
=>
{
dispatch
({
type
:
"changeLoading"
});
const
{
sendTo
,
targetIdList
,
sendProcess
,
initialUnit
,
initialTime
,
intervalTime
,
intervalUnit
,
sendNum
}
=
values
;
const
{
sendTo
,
targetIdList
,
sendProcess
,
initialUnit
,
initialTime
,
intervalTime
,
intervalUnit
,
sendNum
,
}
=
values
;
let
targetNames
=
[];
let
all
=
async
()
=>
{
if
(
sendTo
==
4
)
{
let
data
=
await
roleList
({});
return
{
newArr
:
data
?.
data
?.
dataList
||
[]
}
newArr
:
data
?.
data
?.
dataList
||
[],
};
}
else
if
(
sendTo
==
5
)
{
let
data
=
await
currentUserList
({});
return
{
newArr
:
data
?.
data
?.
dataList
||
[]
}
newArr
:
data
?.
data
?.
dataList
||
[],
};
}
else
{
return
{
newArr
:
[]
}
}
newArr
:
[],
};
}
all
().
then
(
res
=>
{
};
all
().
then
((
res
)
=>
{
let
dataArr
=
res
.
newArr
;
targetNames
=
dataArr
?.
filter
(
it
=>
targetIdList
?.
indexOf
(
it
.
value
)
>
-
1
)?.
map
(
it
=>
it
.
label
)?.
join
(
","
)
||
""
;
targetNames
=
dataArr
?.
filter
((
it
)
=>
targetIdList
?.
indexOf
(
it
.
value
)
>
-
1
)
?.
map
((
it
)
=>
it
.
label
)
?.
join
(
","
)
||
""
;
let
params
=
{
sendTo
,
targetNames
,
sendProcess
,
sendProcessName
:
sendProcessArr
.
filter
(
it
=>
it
.
value
==
sendProcess
).
length
>
0
?
sendProcessArr
.
filter
(
it
=>
it
.
value
==
sendProcess
)[
0
].
label
:
""
,
sendProcessName
:
sendProcessArr
.
filter
((
it
)
=>
it
.
value
==
sendProcess
).
length
>
0
?
sendProcessArr
.
filter
((
it
)
=>
it
.
value
==
sendProcess
)[
0
]
.
label
:
""
,
initialUnit
,
initialTime
,
intervalTime
,
intervalUnit
,
sendNum
,
targetIdList
,
id
:
iftype
.
id
?
iftype
.
id
:
moment
().
valueOf
()
+
Math
.
floor
(
Math
.
random
()
*
(
9999
-
1000
))
+
1000
,
sendToName
:
sendToArr
.
filter
(
it
=>
it
.
value
==
sendTo
).
length
>
0
?
sendToArr
.
filter
(
it
=>
it
.
value
==
sendTo
)[
0
].
label
:
""
,
initialUnitName
:
unitArr
.
filter
(
it
=>
it
.
value
==
initialUnit
).
length
>
0
?
unitArr
.
filter
(
it
=>
it
.
value
==
initialUnit
)[
0
].
label
:
""
,
intervalUnitName
:
unitArr
.
filter
(
it
=>
it
.
value
==
intervalUnit
).
length
>
0
?
unitArr
.
filter
(
it
=>
it
.
value
==
intervalUnit
)[
0
].
label
:
""
id
:
iftype
.
id
?
iftype
.
id
:
moment
().
valueOf
()
+
Math
.
floor
(
Math
.
random
()
*
(
9999
-
1000
))
+
1000
,
sendToName
:
sendToArr
.
filter
((
it
)
=>
it
.
value
==
sendTo
).
length
>
0
?
sendToArr
.
filter
((
it
)
=>
it
.
value
==
sendTo
)[
0
].
label
:
""
,
initialUnitName
:
unitArr
.
filter
((
it
)
=>
it
.
value
==
initialUnit
).
length
>
0
?
unitArr
.
filter
((
it
)
=>
it
.
value
==
initialUnit
)[
0
].
label
:
""
,
intervalUnitName
:
unitArr
.
filter
((
it
)
=>
it
.
value
==
intervalUnit
).
length
>
0
?
unitArr
.
filter
((
it
)
=>
it
.
value
==
intervalUnit
)[
0
].
label
:
""
,
},
newTable
;
if
(
iftype
.
val
==
"edit"
)
{
newTable
=
tableData
.
map
(
it
=>
{
newTable
=
tableData
.
map
((
it
)
=>
{
if
(
it
.
id
==
iftype
.
id
)
{
it
=
{
...
params
}
it
=
{
...
params
};
}
return
it
;
});
...
...
@@ -432,7 +521,7 @@ const Formpage = (props) => {
newTable
.
unshift
(
params
);
}
dispatch
({
type
:
"changeTableData"
,
tableData
:
newTable
});
})
});
},
saveForm
=
()
=>
{
let
editId
=
rowMessage
?
{
id
:
rowMessage
.
id
}
:
{},
...
...
@@ -441,14 +530,14 @@ const Formpage = (props) => {
valuesc
=
await
form
.
validateFields
();
return
{
values
,
valuesc
}
valuesc
,
};
};
all
().
then
(
res
=>
{
all
().
then
((
res
)
=>
{
if
(
!
tableData
.
length
)
{
return
message
.
warning
(
"基础配置不可为空!"
)
return
message
.
warning
(
"基础配置不可为空!"
);
}
let
detailList
=
tableData
.
map
(
it
=>
{
let
detailList
=
tableData
.
map
((
it
)
=>
{
if
(
iftypeParent
.
val
==
"edit"
)
{
return
{
sendProcess
:
it
.
sendProcess
,
...
...
@@ -459,8 +548,8 @@ const Formpage = (props) => {
intervalTime
:
it
.
intervalTime
,
intervalUnit
:
it
.
intervalUnit
,
sendNum
:
it
.
sendNum
,
id
:
it
.
id
&&
typeof
(
it
.
id
)
==
"number"
?
""
:
it
.
id
}
id
:
it
.
id
&&
typeof
it
.
id
==
"number"
?
""
:
it
.
id
,
};
}
else
{
return
{
sendProcess
:
it
.
sendProcess
,
...
...
@@ -470,50 +559,47 @@ const Formpage = (props) => {
initialUnit
:
it
.
initialUnit
,
intervalTime
:
it
.
intervalTime
,
intervalUnit
:
it
.
intervalUnit
,
sendNum
:
it
.
sendNum
}
sendNum
:
it
.
sendNum
,
};
}
}),
params
=
{
...
res
.
values
,
...
res
.
valuesc
,
detailList
,
...
editId
...
editId
,
};
run
({
url
:
"/ngic-base-business/paBusinessMsgOption/save"
,
params
:
{
...
params
}
})
})
run
({
url
:
"/ngic-base-business/paBusinessMsgOption/save"
,
params
:
{
...
params
},
});
});
};
function
showTitleorContent
(
val
)
{
if
(
val
==
4
)
{
dispatch
({
type
:
"changeHideTitle"
,
hidesTitle
:
false
})
dispatch
({
type
:
"changeHideTitle"
,
hidesTitle
:
false
});
}
else
{
dispatch
({
type
:
"changeHideTitle"
,
hidesTitle
:
false
})
dispatch
({
type
:
"changeHideTitle"
,
hidesTitle
:
false
});
}
if
(
val
==
2
)
{
dispatch
({
type
:
"changeHideContent"
,
hidesContent
:
false
})
dispatch
({
type
:
"changeHideContent"
,
hidesContent
:
false
});
}
else
{
dispatch
({
type
:
"changeHideContent"
,
hidesContent
:
false
})
dispatch
({
type
:
"changeHideContent"
,
hidesContent
:
false
});
}
}
};
function
getdatabase
(
val
)
{
let
database
;
switch
(
val
)
{
case
2
:
database
=
factorySelect
database
=
factorySelect
;
break
;
case
3
:
database
=
factory
database
=
zuzhi
;
break
;
case
4
:
database
=
selectionBoxAll
database
=
selectionBoxAll
;
break
;
}
return
database
;
}
...
...
@@ -521,23 +607,23 @@ const Formpage = (props) => {
let
database
;
switch
(
val
)
{
case
4
:
database
=
roleList
database
=
roleList
;
break
;
case
5
:
database
=
currentUserList
database
=
currentUserList
;
break
;
}
return
database
;
}
return
<
div
>
return
(
<
div
>
<
InitForm
fields=
{
formFields
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
for
(
let
i
in
changedValues
)
{
if
(
i
==
"sendMethodType"
)
{
showTitleorContent
(
changedValues
[
i
])
showTitleorContent
(
changedValues
[
i
]);
}
if
(
i
==
"fitField"
)
{
let
database
=
getdatabase
(
changedValues
[
i
]);
...
...
@@ -545,15 +631,18 @@ const Formpage = (props) => {
if
(
j
==
"fieldId"
&&
changedValues
[
i
]
==
1
)
{
formFields
[
j
].
hides
=
true
;
}
else
if
(
j
==
"fieldId"
&&
changedValues
[
i
]
!=
1
)
{
formFields
[
j
].
hides
=
false
formFields
[
j
].
hides
=
false
;
formFields
[
j
].
options
=
{
database
,
params
:
{}
params
:
{},
};
forms
.
setFieldsValue
({
"fieldId"
:
""
})
formFields
[
j
].
type
=
changedValues
[
i
]
==
3
?
"treeselect"
:
"select"
;
forms
.
setFieldsValue
({
fieldId
:
""
});
}
}
dispatch
({
type
:
"changeFormFields"
,
formFields
:
formFields
})
dispatch
({
type
:
"changeFormFields"
,
formFields
:
formFields
});
}
}
}
}
...
...
@@ -561,62 +650,87 @@ const Formpage = (props) => {
return
null
;
}
}
formRef=
{
forms
}
>
</
InitForm
>
></
InitForm
>
<
Form
form=
{
form
}
>
{
!
hidesTitle
&&
<
Form
.
Item
{
!
hidesTitle
&&
(
<
Form
.
Item
name=
"sendTitle"
rules=
{
[
{
required
:
true
,
message
:
'请输入推送标题'
,
message
:
"请输入推送标题"
,
},
]
}
>
<
div
>
<
div
><
span
style=
{
{
color
:
"#ff4d4f"
}
}
>
*
</
span
>
推送标题
</
div
>
<
TextArea
rows=
{
4
}
defaultValue=
{
iftypeParent
.
val
==
"edit"
?
rowMessage
.
sendTitle
:
""
}
/>
<
div
>
<
span
style=
{
{
color
:
"#ff4d4f"
}
}
>
*
</
span
>
推送标题
</
div
>
</
Form
.
Item
>
<
TextArea
rows=
{
4
}
defaultValue=
{
iftypeParent
.
val
==
"edit"
?
rowMessage
.
sendTitle
:
""
}
{
(
!
hidesTitle
||
!
hidesContent
)
&&
<
Button
type=
"primary"
style=
{
{
marginBottom
:
15
}
}
onClick=
{
()
=>
{
/>
</
div
>
</
Form
.
Item
>
)
}
{
(
!
hidesTitle
||
!
hidesContent
)
&&
(
<
Button
type=
"primary"
style=
{
{
marginBottom
:
15
}
}
onClick=
{
()
=>
{
let
params
=
forms
.
getFieldValue
(
"businessMsgSceneId"
);
dispatch
({
type
:
"openVariable"
,
variableExtraparams
:
params
});
}
}
>
查看变量
</
Button
>
}
{
!
hidesContent
&&
<
Form
.
Item
}
}
>
查看变量
</
Button
>
)
}
{
!
hidesContent
&&
(
<
Form
.
Item
name=
"sendContent"
rules=
{
[
{
required
:
true
,
message
:
'请输入推送内容'
,
message
:
"请输入推送内容"
,
},
]
}
>
<
div
>
<
div
><
span
style=
{
{
color
:
"#ff4d4f"
}
}
>
*
</
span
>
推送内容
</
div
>
<
TextArea
rows=
{
4
}
defaultValue=
{
iftypeParent
.
val
==
"edit"
?
rowMessage
.
sendContent
:
""
}
/>
<
div
>
<
span
style=
{
{
color
:
"#ff4d4f"
}
}
>
*
</
span
>
推送内容
</
div
>
</
Form
.
Item
>
<
TextArea
rows=
{
4
}
defaultValue=
{
iftypeParent
.
val
==
"edit"
?
rowMessage
.
sendContent
:
""
}
/>
</
div
>
</
Form
.
Item
>
)
}
</
Form
>
{
!
tableLoading
&&
<
AutoTable
{
!
tableLoading
&&
(
<
AutoTable
pagetitle=
"基础设置"
pageextra=
{
extrarender
}
columns=
{
columns
}
actionRef=
{
actionRef
}
onRef=
{
node
=>
ChildRef
=
node
}
onRef=
{
(
node
)
=>
(
ChildRef
=
node
)
}
dataSource=
{
tableData
}
></
AutoTable
>
}
)
}
<
div
style=
{
{
display
:
"flex"
,
marginTop
:
15
}
}
>
<
Button
loading=
{
loading
}
type=
"primary"
size=
"large"
style=
{
{
flex
:
1
}
}
onClick=
{
saveForm
}
>
提交
</
Button
>
<
Button
loading=
{
loading
}
type=
"primary"
size=
"large"
style=
{
{
flex
:
1
}
}
onClick=
{
saveForm
}
>
提交
</
Button
>
</
div
>
<
Modal
maskClosable=
{
false
}
...
...
@@ -631,7 +745,7 @@ const Formpage = (props) => {
<
InitForm
fields=
{
tableFields
}
submitData=
{
(
values
,
fn
)
=>
{
saveData
(
values
,
fn
)
saveData
(
values
,
fn
);
}
}
formRef=
{
tableFormRef
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
...
...
@@ -639,26 +753,28 @@ const Formpage = (props) => {
if
(
i
==
"sendTo"
)
{
for
(
let
j
in
tableField
)
{
if
(
j
==
"targetIdList"
)
{
tableFormRef
.
setFieldsValue
({
"targetIdList"
:
[]
});
tableFormRef
.
setFieldsValue
({
targetIdList
:
[]
});
tableField
[
j
].
value
=
[];
if
(
changedValues
[
i
]
!=
4
&&
changedValues
[
i
]
!=
5
)
{
tableField
[
j
].
hides
=
true
tableField
[
j
].
hides
=
true
;
}
else
{
let
database
=
getformdatabase
(
changedValues
[
i
]);
tableField
[
j
].
hides
=
false
tableField
[
j
].
hides
=
false
;
tableField
[
j
].
options
=
{
database
,
params
:
{}
}
params
:
{},
};
}
}
}
dispatch
({
type
:
"changeTableFields"
,
tableFields
:
tableField
})
dispatch
({
type
:
"changeTableFields"
,
tableFields
:
tableField
,
});
}
}
}
}
>
</
InitForm
>
></
InitForm
>
</
Modal
>
<
Drawer
title=
{
"查看变量"
}
...
...
@@ -671,9 +787,15 @@ const Formpage = (props) => {
}
}
width=
"40%"
>
{
shown
&&
<
Variable
businessMsgSceneId=
{
variableExtraparams
}
dispatch=
{
dispatch
}
/>
}
{
shown
&&
(
<
Variable
businessMsgSceneId=
{
variableExtraparams
}
dispatch=
{
dispatch
}
/>
)
}
</
Drawer
>
</
div
>
}
);
};
export
default
Formpage
;
src/pages/system/Store/store.js
View file @
2b7e6c2d
...
...
@@ -243,12 +243,7 @@ const StoreApp = (props) => {
actionRef
=
{
actionRef
}
onRef
=
{(
node
)
=>
(
ChildRef
=
node
)}
extraparams
=
{{
storeId
:
props
?.
curitem
?.
id
??
"0"
}}
rowSelection
=
{{
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
setselectedRowKeys
(
selectedRows
)
},
}}
><
/AutoTable
>
<
DrawInitForm
visible
=
{
false
}
...
...
src/services/system.js
View file @
2b7e6c2d
...
...
@@ -191,7 +191,13 @@ export async function factory(params) {
}
//
// 4 :
//集团下拉框
export
async
function
zuzhi
(
params
)
{
return
request
(
`/wms/ngic-auth/sysDepartment/query/tree`
,
{
method
:
'POST'
,
data
:
params
,
});
}
//集团下拉框
export
async
function
depart
(
params
)
{
return
request
(
`/wms/ngic-auth/sysDepartment/query/selectbox/depart`
,
{
...
...
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