Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
1154cf80
Commit
1154cf80
authored
Dec 04, 2020
by
前端-黄佳鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉原先老的需求发布路由
parent
97696e3d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1877 additions
and
146 deletions
+1877
-146
demandPosts.ts
config/routes/tranactionRoute/demandPosts.ts
+117
-117
tableList.tsx
src/pages/transaction/demandPosts/components/tableList.tsx
+1
-1
addForm.tsx
src/pages/transaction/demandPosts/demandAdd/addForm.tsx
+137
-0
modalAnchor.tsx
...on/demandPosts/demandAdd/components/Modal/modalAnchor.tsx
+244
-0
modalGoods.tsx
...ion/demandPosts/demandAdd/components/Modal/modalGoods.tsx
+259
-0
addGoods.tsx
...transaction/demandPosts/demandAdd/components/addGoods.tsx
+185
-0
basicInfo.tsx
...ransaction/demandPosts/demandAdd/components/basicInfo.tsx
+286
-0
demandDbutted.tsx
...action/demandPosts/demandAdd/components/demandDbutted.tsx
+228
-0
flowRecord.tsx
...ansaction/demandPosts/demandAdd/components/flowRecord.tsx
+96
-0
index.less
...s/transaction/demandPosts/demandAdd/components/index.less
+143
-0
tradingConditions.tsx
...on/demandPosts/demandAdd/components/tradingConditions.tsx
+139
-0
details.tsx
src/pages/transaction/inquiryQuote/components/details.tsx
+42
-28
No files found.
config/routes/tranactionRoute/demandPosts.ts
View file @
1154cf80
This diff is collapsed.
Click to expand it.
src/pages/transaction/demandPosts/components/tableList.tsx
View file @
1154cf80
...
...
@@ -128,7 +128,7 @@ const TableListInfo: React.FC<tableListParams> = (props) => {
type
===
2
&&
<
Col
span=
{
24
}
>
<
Space
direction=
"horizontal"
size=
{
16
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
history
.
push
(
'/memberCenter/tranactionAbility/
enquirySubmit/addDemandOrder
/add'
)
}
icon=
{
<
PlusOutlined
/>
}
>
新建
</
Button
>
<
Button
type=
"primary"
onClick=
{
()
=>
history
.
push
(
'/memberCenter/tranactionAbility/
demandPosts/demandAdd
/add'
)
}
icon=
{
<
PlusOutlined
/>
}
>
新建
</
Button
>
<
Button
onClick=
{
()
=>
batch
()
}
loading=
{
loading
}
>
批量提交审核
</
Button
>
<
Dropdown
.
Button
overlay=
{
menu
}
...
...
src/pages/transaction/demandPosts/demandAdd/addForm.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
;
import
{
history
}
from
'umi'
;
import
ReutrnEle
from
'@/components/ReturnEle'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
Button
,
Card
,
Tabs
}
from
'antd'
;
import
BasicInfo
from
'./components/basicInfo'
;
import
TradingConditions
from
'./components/tradingConditions'
import
FlowRecord
from
'./components/flowRecord'
;
import
AddGoods
from
'./components/addGoods'
;
import
DemandDbutted
from
'./components/demandDbutted'
;
import
{
PublicApi
}
from
'@/services/api'
;
const
{
TabPane
}
=
Tabs
;
const
AddDemandOrder
:
React
.
FC
<
{}
>
=
()
=>
{
const
{
id
}
=
history
.
location
.
query
;
const
[
fetchdata
,
setfetchdata
]
=
useState
<
any
>
({});
const
basic
=
useRef
<
any
>
();
const
goods
=
useRef
<
any
>
();
const
trading
=
useRef
<
any
>
();
/**get子组件的数据 */
/**提交数据 */
const
onSubmit
=
async
()
=>
{
const
basicRef
=
await
basic
.
current
.
get
();
const
goodsRef
=
await
goods
.
current
.
get
();
const
tradingRef
=
await
trading
.
current
.
get
();
if
(
basicRef
.
state
&&
tradingRef
.
state
&&
goodsRef
.
state
)
{
const
data
=
{
...
basicRef
.
data
,
...
tradingRef
.
data
,
...
goodsRef
.
data
,
type
:
1
,
shopIds
:
[
1
]
}
if
(
basicRef
.
data
.
requisitionFormAddress
.
length
>
0
)
{
data
.
defaultAddres
=
0
}
else
{
data
.
defaultAddres
=
1
}
if
(
id
)
{
data
.
id
=
fetchdata
.
id
;
PublicApi
.
postOrderRequisitionFormUpdate
(
data
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
history
.
goBack
()
}
})
}
else
{
PublicApi
.
postOrderRequisitionFormAdd
(
data
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
history
.
goBack
()
}
})
}
}
}
useEffect
(()
=>
{
if
(
id
)
{
new
Promise
(
resolve
=>
{
PublicApi
.
getOrderRequisitionFormDetails
({
id
,
current
:
'1'
,
pageSize
:
'10'
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
}).
then
((
res
:
any
)
=>
{
setfetchdata
(
res
)
})
}
},
[
id
])
/**获取添加的商品品类id */
const
getCategoryIds
=
(
ids
:
any
)
=>
{
const
categoryIds
:
any
=
[];
const
attributeList
:
any
=
[];
ids
.
forEach
(
v
=>
{
let
id
=
v
.
ids
[
v
.
ids
.
length
-
1
];
categoryIds
.
push
([...
categoryIds
,
...
id
])
let
productAttributeJson
=
JSON
.
parse
(
v
.
productAttributeJson
);
productAttributeJson
.
forEach
(
vs
=>
{
console
.
log
(
vs
)
attributeList
.
push
({
attributeValue
:
vs
})
})
console
.
log
(
categoryIds
,
attributeList
)
})
console
.
log
(
ids
)
}
return
(
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
extra=
{
<
Button
type=
"primary"
onClick=
{
onSubmit
}
>
保存
</
Button
>
}
>
<
Card
>
<
Tabs
type=
'card'
>
<
TabPane
forceRender
tab=
'基本信息'
key=
'1'
>
<
BasicInfo
set=
{
fetchdata
}
currentRef=
{
basic
}
/>
</
TabPane
>
<
TabPane
forceRender
tab=
'添加商品'
key=
'2'
>
<
AddGoods
set=
{
fetchdata
}
onGet=
{
getCategoryIds
}
currentRef=
{
goods
}
/>
</
TabPane
>
<
TabPane
forceRender
tab=
'交易条件'
key=
'3'
>
<
TradingConditions
set=
{
fetchdata
}
currentRef=
{
trading
}
/>
</
TabPane
>
<
TabPane
forceRender
tab=
'需求对接'
key=
'4'
>
<
DemandDbutted
set=
{
fetchdata
}
/>
</
TabPane
>
<
TabPane
forceRender
tab=
'流转记录'
key=
'5'
>
<
FlowRecord
set=
{
fetchdata
}
/>
</
TabPane
>
</
Tabs
>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
AddDemandOrder
;
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/Modal/modalAnchor.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
{
Modal
,
Anchor
,
Layout
,
Menu
,
Form
,
Divider
,
Input
,
Button
,
Upload
,
Select
,
AutoComplete
,
Cascader
,
Spin
,
InputNumber
}
from
'antd'
;
import
style
from
'../index.less'
;
import
{
LinkOutlined
,
DeleteOutlined
,
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
PublicApi
}
from
'@/services/api'
;
const
layout
:
any
=
{
colon
:
false
,
labelCol
:
{
style
:
{
width
:
'110px'
}
},
labelAlign
:
"left"
};
const
{
Sider
,
Content
}
=
Layout
;
const
{
Link
}
=
Anchor
;
interface
anchorParams
{
visible
?:
boolean
,
onOk
?:
Function
,
onCancel
?:
Function
,
fetchdata
?:
any
,
isEdit
?:
boolean
}
const
{
Option
}
=
Select
;
const
ModalAnchor
:
React
.
FC
<
anchorParams
>
=
(
props
)
=>
{
const
{
visible
,
onOk
,
onCancel
,
fetchdata
,
isEdit
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
loading
,
setloading
]
=
useState
(
false
);
const
[
files
,
setFiles
]
=
useState
([]);
const
[
categoryById
,
setCategoryById
]
=
useState
<
any
>
({});
const
[
selected
,
setselected
]
=
useState
<
string
>
(
''
)
const
[
category
,
setcategory
]
=
useState
<
Array
<
any
>>
([]);
/**查询品类树 */
const
searchCategoryTree
=
(
id
:
any
)
=>
{
return
new
Promise
(
resolve
=>
{
PublicApi
.
getProductPlatformGetCategoryTree
({
rootNodeId
:
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
}).
then
((
data
:
any
)
=>
{
setcategory
(
data
)
})
}
/**查询品类信息--包括品类、属性、属性值 */
const
getCategoryById
=
(
val
:
any
,
selectedOptions
?:
any
)
=>
{
const
id
=
val
[
val
.
length
-
1
];
if
(
!
isEdit
&&
selectedOptions
.
length
>
0
)
{
const
name
=
selectedOptions
[
selectedOptions
.
length
-
1
];
setselected
(
name
.
title
)
}
PublicApi
.
getProductPlatformGetCategoryById
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setCategoryById
(
res
.
data
)
}
})
}
useEffect
(()
=>
{
form
.
resetFields
();
searchCategoryTree
(
'0'
)
if
(
Object
.
keys
(
fetchdata
).
length
>
0
&&
isEdit
)
{
getCategoryById
(
fetchdata
.
ids
)
const
productAttributeJson
=
JSON
.
parse
(
fetchdata
.
productAttributeJson
);
let
obj
:
any
=
{}
let
newObj
:
any
=
{}
productAttributeJson
.
forEach
((
item
:
any
)
=>
{
obj
=
{...
obj
,
...
item
}
for
(
let
key
in
obj
)
{
newObj
=
{...
newObj
,
...{
[
`
${
key
}
__`
]:
obj
[
key
].
join
(
','
)
}}
}
})
form
.
setFieldsValue
({
model
:
fetchdata
.
model
,
brand
:
fetchdata
.
brand
,
unit
:
fetchdata
.
unit
,
purchaseCount
:
fetchdata
.
purchaseCount
,
name
:
fetchdata
.
name
,
category
:
fetchdata
.
ids
,
goodsNo
:
fetchdata
.
goodsNo
,
specialExplain
:
fetchdata
.
specialExplain
,
...
newObj
})
}
},
[
visible
])
const
onSubmit
=
(
value
:
any
)
=>
{
form
.
validateFields
().
then
(
res
=>
{
const
productAttributeJson
:
Array
<
any
>
=
[];
for
(
let
key
in
res
)
{
if
(
key
.
split
(
'__'
).
length
>
1
)
{
const
name
=
key
.
replace
(
/__/g
,
''
)
productAttributeJson
.
push
({
[
name
]:
[
res
[
key
]]
})
}
}
const
data
=
{
model
:
res
.
model
,
brand
:
res
.
brand
,
productAttributeJson
:
JSON
.
stringify
(
productAttributeJson
),
unit
:
res
.
unit
,
purchaseCount
:
res
.
purchaseCount
,
name
:
res
.
name
,
category
:
selected
,
goodsNo
:
res
.
goodsNo
,
ids
:
res
.
category
,
urls
:
files
,
specialExplain
:
res
.
specialExplain
,
}
onOk
(
data
)
form
.
resetFields
();
setCategoryById
([])
}).
catch
(
error
=>
{
console
.
log
(
error
)
})
}
return
(
<
Modal
title=
'通过平台属性添加'
width=
'800px'
maskClosable=
{
false
}
destroyOnClose
wrapClassName=
{
style
.
modal_wrap_className
}
bodyStyle=
{
{
padding
:
'0px'
}
}
visible=
{
visible
}
onCancel=
{
()
=>
onCancel
()
}
onOk=
{
onSubmit
}
>
<
Layout
>
<
Sider
width=
{
159
}
className=
{
style
.
site_layout_background
}
>
<
Anchor
bounds=
{
0
}
targetOffset=
{
120
}
affix=
{
false
}
>
<
Menu
mode=
'inline'
defaultSelectedKeys=
{
[
'1'
]
}
>
<
Menu
.
Item
key=
"1"
><
Link
href=
'#basic_info'
title=
'基本信息'
/></
Menu
.
Item
>
{
Object
.
keys
(
categoryById
).
length
>
0
&&
<
Menu
.
Item
key=
"2"
><
Link
href=
'#category'
title=
{
categoryById
.
name
}
/></
Menu
.
Item
>
}
<
Menu
.
Item
key=
"3"
><
Link
href=
'#other_demand'
title=
'其他要求'
/></
Menu
.
Item
>
<
Menu
.
Item
key=
"4"
><
Link
href=
'#procured_amount'
title=
'采购数量'
/></
Menu
.
Item
>
</
Menu
>
</
Anchor
>
</
Sider
>
<
Content
className=
{
style
.
site_content_style
}
>
<
Form
form=
{
form
}
{
...
layout
}
>
<
div
id=
'basic_info'
>
<
div
className=
{
style
.
affix_title
}
><
Divider
type=
"vertical"
className=
{
style
.
divider_style
}
/>
基本信息
</
div
>
<
Form
.
Item
label=
'商品品类'
name=
'category'
rules=
{
[{
required
:
true
,
message
:
'请选择商品品类'
}]
}
>
<
Cascader
options=
{
category
}
fieldNames=
{
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
}
}
placeholder=
"请选择品类"
notFoundContent=
{
<
Spin
size=
"small"
/>
}
onChange=
{
getCategoryById
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'商品编号'
name=
'goodsNo'
rules=
{
[{
required
:
true
,
message
:
'请输入商品编号'
}]
}
><
Input
/></
Form
.
Item
>
<
Form
.
Item
label=
'商品名称'
name=
'name'
rules=
{
[{
required
:
true
,
message
:
'请输入商品名称'
}]
}
><
Input
/></
Form
.
Item
>
<
Form
.
Item
label=
'规格型号'
name=
'model'
rules=
{
[{
required
:
true
,
message
:
'请输入规格型号'
}]
}
><
Input
/></
Form
.
Item
>
<
Form
.
Item
label=
'规格品牌'
name=
'brand'
><
Input
/></
Form
.
Item
>
</
div
>
{
Object
.
keys
(
categoryById
).
length
>
0
&&
<
div
id=
'category'
>
<
div
className=
{
style
.
affix_title
}
><
Divider
type=
"vertical"
className=
{
style
.
divider_style
}
/>
{
categoryById
.
name
}
</
div
>
{
categoryById
.
attributeList
.
length
>
0
&&
categoryById
.
attributeList
.
map
((
item
:
any
,
index
:
number
)
=>
(
<
Form
.
Item
label=
{
item
.
groupName
}
name=
{
`${item.groupName}__`
}
key=
{
item
.
groupId
}
rules=
{
[{
required
:
item
.
isEmpty
,
message
:
`请选择${item.groupName}`
}]
}
>
<
AutoComplete
>
{
item
.
attributeValueList
.
map
((
items
:
any
)
=>
(
<
AutoComplete
.
Option
value=
{
items
.
value
}
key=
{
items
.
id
}
>
{
items
.
value
}
</
AutoComplete
.
Option
>
))
}
</
AutoComplete
>
</
Form
.
Item
>
))
}
</
div
>
}
<
div
id=
'other_demand'
>
<
div
className=
{
style
.
affix_title
}
><
Divider
type=
"vertical"
className=
{
style
.
divider_style
}
/>
其他要求
</
div
>
<
Form
.
Item
label=
'特殊说明'
name=
'specialExplain'
><
Input
.
TextArea
rows=
{
4
}
/></
Form
.
Item
>
<
Form
.
Item
label=
'附件'
name=
'upload'
>
<
div
className=
{
style
.
upload_data
}
>
{
files
.
length
>
0
&&
files
.
map
((
v
,
index
)
=>
(
<
div
key=
{
index
}
className=
{
style
.
upload_item
}
>
<
div
className=
{
style
.
upload_left
}
>
<
LinkOutlined
/>
<
span
>
{
v
.
name
}
</
span
>
</
div
>
<
div
className=
{
style
.
upload_right
}
>
<
DeleteOutlined
/>
</
div
>
</
div
>
))
}
</
div
>
<
Upload
action=
"/api/file/file/upload"
data=
{
{
fileType
:
UPLOAD_TYPE
}
}
showUploadList=
{
false
}
accept=
'.doc,.docx,.pdf,.ppt,.pptx,.xls,.xlsx'
>
<
Button
loading=
{
loading
}
icon=
{
<
UploadOutlined
/>
}
>
上传文件
</
Button
>
<
div
style=
{
{
marginTop
:
'8px'
}
}
>
一次上传一个文件,每个附件大小不能超过 20M
</
div
>
</
Upload
>
</
Form
.
Item
>
</
div
>
<
div
id=
'procured_amount'
>
<
div
className=
{
style
.
affix_title
}
><
Divider
type=
"vertical"
className=
{
style
.
divider_style
}
/>
采购数量
</
div
>
<
Form
.
Item
label=
'单位'
name=
'unit'
rules=
{
[{
required
:
true
,
message
:
'请选择单位'
}]
}
><
Input
/></
Form
.
Item
>
<
Form
.
Item
label=
'采购数量'
name=
'purchaseCount'
rules=
{
[{
required
:
true
,
message
:
'请输入采购数量'
}]
}
><
InputNumber
min=
{
1
}
style=
{
{
width
:
'100%'
}
}
/></
Form
.
Item
>
</
div
>
</
Form
>
</
Content
>
</
Layout
>
</
Modal
>
)
}
export
default
ModalAnchor
;
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/Modal/modalGoods.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
{
Modal
,
Anchor
,
Layout
,
Menu
,
Form
,
Divider
,
Input
,
Button
,
Upload
,
Cascader
,
Spin
,
InputNumber
}
from
'antd'
;
import
style
from
'../index.less'
;
import
{
LinkOutlined
,
DeleteOutlined
,
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
ModalTable
from
'@/components/ModalTable'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
;
const
layout
:
any
=
{
colon
:
false
,
labelCol
:
{
style
:
{
width
:
'110px'
}
},
labelAlign
:
"left"
};
const
{
Sider
,
Content
}
=
Layout
;
const
{
Link
}
=
Anchor
;
interface
goodsParams
{
visible
?:
boolean
,
onOk
?:
Function
,
onCancel
?:
Function
,
fetchdata
?:
any
,
isEdit
?:
boolean
}
const
ModalGoods
:
React
.
FC
<
goodsParams
>
=
(
props
)
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
visible
,
onOk
,
onCancel
,
fetchdata
,
isEdit
}
=
props
;
const
[
loading
,
setloading
]
=
useState
(
false
);
const
[
files
,
setFiles
]
=
useState
([]);
const
[
category
,
setcategory
]
=
useState
<
Array
<
any
>>
([]);
const
[
rowSelection
,
RowCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
,
type
:
'radio'
});
const
[
visibleChannelGoods
,
setvisibleChannelGoods
]
=
useState
<
boolean
>
(
false
);
const
[
goods
,
setGoods
]
=
useState
<
any
>
({})
/**查询品类树 */
const
searchCategoryTree
=
(
id
:
any
)
=>
{
return
new
Promise
(
resolve
=>
{
PublicApi
.
getProductPlatformGetCategoryTree
({
rootNodeId
:
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
}).
then
((
data
:
any
)
=>
{
setcategory
(
data
)
})
}
useEffect
(()
=>
{
form
.
resetFields
();
RowCtl
.
setSelectRow
([])
RowCtl
.
setSelectedRowKeys
([])
searchCategoryTree
(
'0'
);
if
(
Object
.
keys
(
fetchdata
).
length
>
0
&&
isEdit
)
{
const
params
:
any
=
{
current
:
'1'
,
pageSize
:
'10'
,
code
:
fetchdata
.
goodsNo
}
PublicApi
.
getProductGoodsGetGoodsList
({
...
params
}).
then
(
res
=>
{
const
{
data
}
=
res
RowCtl
.
setSelectRow
(
data
.
data
)
RowCtl
.
setSelectedRowKeys
([
data
.
data
[
0
].
id
])
})
form
.
setFieldsValue
({
model
:
fetchdata
.
model
,
brand
:
fetchdata
.
brand
,
unit
:
fetchdata
.
unit
,
purchaseCount
:
fetchdata
.
purchaseCount
,
name
:
fetchdata
.
name
,
category
:
fetchdata
.
category
,
goodsNo
:
fetchdata
.
goodsNo
,
})
}
},
[
visible
])
/**提交表单 */
const
onSubmit
=
(
value
:
any
)
=>
{
form
.
validateFields
().
then
(
res
=>
{
console
.
log
(
rowSelection
,
RowCtl
,
10086
)
const
data
=
{
...
res
,
goodsId
:
goods
.
id
,
goodsName
:
goods
.
name
}
onOk
(
res
,
goods
)
}).
catch
(
error
=>
{
console
.
log
(
error
)
})
}
/**货品表头 */
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'货号'
,
key
:
'code'
,
dataIndex
:
'code'
},
{
title
:
'货品名称'
,
key
:
'name'
,
dataIndex
:
'name'
},
{
title
:
'规格型号'
,
key
:
'type'
,
dataIndex
:
'type'
},
{
title
:
'品类'
,
key
:
'customerCategory'
,
dataIndex
:
'customerCategory'
,
render
:
(
text
:
any
)
=>
<
span
>
{
text
.
name
}
</
span
>
},
{
title
:
'品牌'
,
key
:
'brand'
,
dataIndex
:
'brand'
,
render
:
(
text
:
any
)
=>
<
span
>
{
text
.
name
}
</
span
>
},
{
title
:
'单位'
,
key
:
'unitName'
,
dataIndex
:
'unitName'
},
]
/** 获取货品 */
const
fetchGoodsData
=
(
params
:
any
)
=>
{
return
new
Promise
(
resolve
=>
{
PublicApi
.
getProductGoodsGetGoodsList
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
})
}
/** 选择货品 */
const
handleConfirm
=
()
=>
{
setvisibleChannelGoods
(
false
)
const
data
=
RowCtl
.
selectRow
[
0
]
const
fullId
=
data
.
customerCategory
.
fullId
const
ids
=
fullId
.
replace
(
/
\b(
0+
)
/gi
,
''
).
split
(
'.'
);
setGoods
(
data
)
form
.
setFieldsValue
({
goodsNo
:
data
.
code
,
name
:
data
.
name
,
model
:
data
.
type
,
category
:
ids
.
join
(
','
).
split
(
','
),
brand
:
data
.
brand
.
name
,
unit
:
data
.
unitName
,
})
}
return
(
<>
<
Modal
title=
'通过平台属性添加'
width=
'800px'
wrapClassName=
{
style
.
modal_wrap_className
}
bodyStyle=
{
{
padding
:
'0px'
}
}
visible=
{
visible
}
onCancel=
{
()
=>
onCancel
()
}
onOk=
{
onSubmit
}
>
<
Layout
>
<
Sider
width=
{
159
}
className=
{
style
.
site_layout_background
}
>
<
Anchor
bounds=
{
0
}
targetOffset=
{
120
}
affix=
{
false
}
>
<
Menu
mode=
'inline'
defaultSelectedKeys=
{
[
'1'
]
}
>
<
Menu
.
Item
key=
"1"
><
Link
href=
'#basic_info'
title=
'基本信息'
/></
Menu
.
Item
>
<
Menu
.
Item
key=
"2"
><
Link
href=
'#procured_amount'
title=
'采购数量'
/></
Menu
.
Item
>
<
Menu
.
Item
key=
"3"
><
Link
href=
'#other_demand'
title=
'附件'
/></
Menu
.
Item
>
</
Menu
>
</
Anchor
>
</
Sider
>
<
Content
className=
{
style
.
site_content_style
}
>
<
Form
form=
{
form
}
{
...
layout
}
>
<
div
id=
'basic_info'
>
<
div
className=
{
style
.
affix_title
}
><
Divider
type=
"vertical"
className=
{
style
.
divider_style
}
/>
基本信息
</
div
>
<
Form
.
Item
label=
'货号'
name=
'goodsNo'
rules=
{
[{
required
:
true
,
message
:
'请输入商品编号'
}]
}
><
Input
.
Search
enterButton=
{
<><
LinkOutlined
/>
选择
</>
}
onSearch=
{
()
=>
setvisibleChannelGoods
(
true
)
}
/></
Form
.
Item
>
<
Form
.
Item
label=
'货品名称'
name=
'name'
rules=
{
[{
required
:
true
,
message
:
'请输入货品名称'
}]
}
><
Input
/></
Form
.
Item
>
<
Form
.
Item
label=
'规格型号'
name=
'model'
rules=
{
[{
required
:
true
,
message
:
'请输入规格型号'
}]
}
><
Input
/></
Form
.
Item
>
<
Form
.
Item
label=
'商品品类'
name=
'category'
rules=
{
[{
required
:
true
,
message
:
'请选择商品品类'
}]
}
>
<
Cascader
options=
{
category
}
fieldNames=
{
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
}
}
placeholder=
"请选择品类"
notFoundContent=
{
<
Spin
size=
"small"
/>
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'货品品牌'
name=
'brand'
><
Input
/></
Form
.
Item
>
</
div
>
<
div
id=
'procured_amount'
>
<
div
className=
{
style
.
affix_title
}
><
Divider
type=
"vertical"
className=
{
style
.
divider_style
}
/>
采购数量
</
div
>
<
Form
.
Item
label=
'单位'
name=
'unit'
rules=
{
[{
required
:
true
,
message
:
'请选择单位'
}]
}
><
Input
/></
Form
.
Item
>
<
Form
.
Item
label=
'采购数量'
name=
'purchaseCount'
rules=
{
[{
required
:
true
,
message
:
'请输入采购数量'
}]
}
><
InputNumber
min=
{
1
}
style=
{
{
width
:
'100%'
}
}
/></
Form
.
Item
>
</
div
>
<
div
id=
'other_demand'
>
<
div
className=
{
style
.
affix_title
}
><
Divider
type=
"vertical"
className=
{
style
.
divider_style
}
/>
其他要求
</
div
>
<
Form
.
Item
label=
'附件'
name=
'upload'
>
<
div
className=
{
style
.
upload_data
}
>
{
files
.
length
>
0
&&
files
.
map
((
v
,
index
)
=>
(
<
div
key=
{
index
}
className=
{
style
.
upload_item
}
>
<
div
className=
{
style
.
upload_left
}
>
<
LinkOutlined
/>
<
span
>
{
v
.
name
}
</
span
>
</
div
>
<
div
className=
{
style
.
upload_right
}
>
<
DeleteOutlined
/>
</
div
>
</
div
>
))
}
</
div
>
<
Upload
action=
"/api/file/file/upload"
data=
{
{
fileType
:
UPLOAD_TYPE
}
}
showUploadList=
{
false
}
accept=
'.doc,.docx,.pdf,.ppt,.pptx,.xls,.xlsx'
>
<
Button
loading=
{
loading
}
icon=
{
<
UploadOutlined
/>
}
>
上传文件
</
Button
>
<
div
style=
{
{
marginTop
:
'8px'
}
}
>
一次上传一个文件,每个附件大小不能超过 20M
</
div
>
</
Upload
>
</
Form
.
Item
>
</
div
>
</
Form
>
</
Content
>
</
Layout
>
</
Modal
>
<
ModalTable
width=
{
810
}
modalTitle=
'选择货品'
columns=
{
columns
}
rowSelection=
{
rowSelection
}
visible=
{
visibleChannelGoods
}
confirm=
{
handleConfirm
}
cancel=
{
()
=>
setvisibleChannelGoods
(
false
)
}
fetchTableData=
{
params
=>
fetchGoodsData
(
params
)
}
forceRender=
{
true
}
modalType=
'goodsModalSchema'
tableProps=
{
{
rowKey
:
'id'
,
}
}
resetModal=
{
{
destroyOnClose
:
true
}
}
/>
</>
)
}
export
default
ModalGoods
;
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/addGoods.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useState
,
ReactNode
,
useEffect
}
from
'react'
;
import
{
Form
,
Radio
,
Button
,
Table
}
from
'antd'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
ModalAnchor
from
'./Modal/modalAnchor'
;
import
ModalGoods
from
'./Modal/modalGoods'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PublicApi
}
from
'@/services/api'
;
const
layout
:
any
=
{
colon
:
false
,
labelCol
:
{
style
:
{
width
:
'174px'
}
},
wrapperCol
:
{
span
:
9
},
labelAlign
:
"left"
};
export
interface
faceSetData
{
set
?:
any
,
onGet
?:
Function
,
currentRef
:
any
}
const
AddGoods
:
React
.
FC
<
faceSetData
>
=
(
props
)
=>
{
const
{
set
,
currentRef
,
onGet
}
=
props
const
[
form
]
=
Form
.
useForm
();
const
[
type
,
setType
]
=
useState
<
number
>
(
0
);
const
btnname
:
Array
<
string
>
=
[
'添加商品'
,
'选择货品'
,
'导入货品'
]
const
[
visible
,
setvisible
]
=
useState
<
Array
<
boolean
>>
([
false
,
false
,
false
,
false
]);
const
[
tabledata
,
settabledata
]
=
useState
<
any
>
([])
/**存放编辑的商品数据 */
const
[
editdata
,
seteditdata
]
=
useState
<
any
>
({});
/**是否编辑 */
const
[
isEdit
,
setisEdit
]
=
useState
<
boolean
>
(
false
);
/**编辑的下标 */
const
[
idx
,
setidx
]
=
useState
<
number
>
(
-
1
);
/** 平台属性添加表头 */
const
columns
:
ColumnType
<
Object
>
[]
=
[
{
title
:
'商品编号'
,
key
:
'goodsNo'
,
dataIndex
:
'goodsNo'
,
},
{
title
:
'商品名称'
,
key
:
'name'
,
dataIndex
:
'name'
,
},
{
title
:
'规格型号'
,
key
:
'model'
,
dataIndex
:
'model'
,
},
{
title
:
'品类'
,
key
:
'category'
,
dataIndex
:
'category'
,
},
{
title
:
'品牌'
,
key
:
'brand'
,
dataIndex
:
'brand'
,
},
{
title
:
'采购数量'
,
key
:
'purchaseCount'
,
dataIndex
:
'purchaseCount'
,
},
{
title
:
'操作'
,
key
:
'options'
,
dataIndex
:
'options'
,
render
:
(
text
:
any
,
record
:
any
,
index
:
number
)
=>
<>
<
Button
type=
'link'
onClick=
{
()
=>
handleEdit
(
record
,
index
)
}
>
编辑
</
Button
>
<
Button
type=
'link'
>
删除
</
Button
>
</>
}
]
/** 切换添加方式 */
const
changeRadio
=
(
e
:
any
)
=>
{
const
{
value
}
=
e
.
target
;
setType
(
value
);
settabledata
([]);
}
/** 按钮的文字 */
const
handleText
=
(
num
:
any
)
=>
{
let
text
:
ReactNode
=
null
;
text
=
btnname
[
num
-
1
];
return
text
}
/**
* @name: 操作弹窗
* @arg: 1.通过平台属性添加 2.选择货品添加 3.导入货品生成
* */
const
handleModal
=
(
arg
:
number
)
=>
{
visible
[
arg
]
=
!
visible
[
arg
]
setvisible
([...
visible
])
}
/** 商品添加确定 */
const
handleSubmit
=
(
data
:
any
,
record
?:
any
)
=>
{
if
(
idx
===
-
1
)
{
settabledata
([...
tabledata
,
data
])
}
else
{
const
newdata
=
[...
tabledata
]
newdata
[
idx
]
=
data
settabledata
([...
newdata
]);
setidx
(
-
1
);
}
onGet
([...
tabledata
,
data
])
handleModal
(
type
);
}
/** 编辑商品 */
const
handleEdit
=
(
record
:
any
,
index
:
number
)
=>
{
setidx
(
index
);
seteditdata
(
record
)
setisEdit
(
true
)
handleModal
(
type
)
}
useEffect
(()
=>
{
currentRef
.
current
=
{
get
:
()
=>
new
Promise
((
resolve
:
any
)
=>
{
form
.
validateFields
().
then
(
res
=>
{
resolve
({
state
:
true
,
name
:
'addGoods'
,
data
:
{
type
,
requisitionFormProducts
:
tabledata
,
}
})
}).
catch
(
error
=>
{
console
.
log
(
error
)
})
})
}
},
[
tabledata
])
useEffect
(()
=>
{
/**编辑回显数据 */
if
(
Object
.
keys
(
set
).
length
>
0
)
{
form
.
setFieldsValue
({
type
:
set
.
type
})
setType
(
set
.
type
)
settabledata
(
set
.
requisitionFormProducts
)
}
},
[
set
])
return
(
<
Form
{
...
layout
}
form=
{
form
}
>
<
Form
.
Item
label=
'添加方式'
name=
'type'
rules=
{
[{
required
:
true
,
message
:
'请选择添加方式'
}]
}
>
<
Radio
.
Group
onChange=
{
changeRadio
}
>
<
Radio
value=
{
1
}
>
通过平台属性添加
</
Radio
>
<
Radio
value=
{
2
}
>
选择货品添加
</
Radio
>
<
Radio
value=
{
3
}
>
导入货品生成
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
{
type
>
0
&&
<
Form
.
Item
noStyle
>
<
Button
onClick=
{
()
=>
{
handleModal
(
type
);
setisEdit
(
false
)
}
}
type=
'dashed'
block
style=
{
{
marginBottom
:
'24px'
}
}
><
PlusOutlined
/>
{
handleText
(
type
)
}
</
Button
>
<
Table
columns=
{
columns
}
dataSource=
{
tabledata
}
rowKey=
{
(
record
,
index
)
=>
index
}
/>
</
Form
.
Item
>
}
<
ModalAnchor
fetchdata=
{
editdata
}
isEdit=
{
isEdit
}
visible=
{
visible
[
1
]
}
onOk=
{
handleSubmit
}
onCancel=
{
()
=>
handleModal
(
type
)
}
/>
<
ModalGoods
fetchdata=
{
editdata
}
isEdit=
{
isEdit
}
visible=
{
visible
[
2
]
}
onOk=
{
handleSubmit
}
onCancel=
{
()
=>
handleModal
(
type
)
}
/>
</
Form
>
)
}
export
default
AddGoods
;
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/basicInfo.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
Tooltip
,
Button
,
Select
,
Row
,
Col
,
message
}
from
'antd'
;
import
{
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
style
from
'./index.less'
;
const
layout
:
any
=
{
colon
:
false
,
labelCol
:
{
style
:
{
width
:
'174px'
}
},
wrapperCol
:
{
span
:
9
},
labelAlign
:
"left"
};
export
interface
faceSetData
{
set
?:
any
,
get
?:
Function
,
currentRef
?:
any
}
const
{
Option
}
=
Select
;
const
BasicInfo
:
React
.
FC
<
faceSetData
>
=
(
props
)
=>
{
const
[
form
]
=
Form
.
useForm
();
const
{
set
,
get
,
currentRef
}
=
props
const
[
province
,
setprovince
]
=
useState
<
any
>
([]);
// 省列表
const
[
city
,
setcity
]
=
useState
<
any
>
([]);
// 市列表
const
[
requisitionFormAddress
,
setrequisitionFormAddress
]
=
useState
<
any
>
([{
provinceCode
:
''
,
province
:
''
,
cityCode
:
''
,
city
:
''
}]);
const
[
code
,
setcode
]
=
useState
<
any
>
([]);
//获取所有得地区
const
manageProvince
=
()
=>
{
return
new
Promise
(
resolve
=>
{
PublicApi
.
getManageAreaAll
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
);
}
})
})
}
// 选择下拉得内容
const
handProvince
=
async
(
val
:
any
,
idx
:
number
,
num
:
number
)
=>
{
const
result
=
[...
requisitionFormAddress
];
const
cityCode
:
Array
<
any
>
=
[]
result
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
cityCode
)
{
cityCode
.
push
(
item
.
cityCode
)
}
})
setcode
([...
cityCode
]);
if
(
num
===
1
)
{
await
province
.
forEach
(
item
=>
{
if
(
item
.
code
===
val
)
{
PublicApi
.
getManageAreaByPcodeAll
({
pcode
:
val
}).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
1000
)
{
result
[
idx
].
provinceCode
=
val
;
result
[
idx
].
province
=
item
.
name
;
city
[
idx
]
=
{
citydata
:
res
.
data
}
setcity
([...
city
])
}
})
}
})
}
else
{
city
.
forEach
(
item
=>
{
item
.
citydata
.
forEach
(
items
=>
{
if
(
items
.
code
===
val
)
{
const
cityCode
=
code
.
find
(
it
=>
items
.
code
);
if
(
cityCode
!==
items
.
code
)
{
items
.
disabled
=
false
}
result
[
idx
].
cityCode
=
val
;
result
[
idx
].
city
=
items
.
name
;
}
})
})
setcity
([...
city
])
}
setrequisitionFormAddress
(
result
);
}
// 选择城市的时候下拉就调用方
const
onDropdownVisibleChange
=
()
=>
{
return
new
Promise
(
reslove
=>
reslove
(
code
)).
then
((
res
:
any
)
=>
{
city
.
forEach
((
item
:
any
)
=>
{
item
.
citydata
.
filter
(
it
=>
{
res
.
map
(
items
=>
{
if
(
items
===
it
.
code
)
{
it
.
disabled
=
true
}
})
})
})
setcity
([...
city
])
})
}
// 添加一条地址
const
addFormAddress
=
(
idx
:
number
)
=>
{
const
address
:
any
=
{
provinceCode
:
''
,
province
:
''
,
cityCode
:
''
,
city
:
''
}
if
(
requisitionFormAddress
[
idx
].
provinceCode
&&
requisitionFormAddress
[
idx
].
cityCode
)
{
setrequisitionFormAddress
([...
requisitionFormAddress
,
address
])
}
else
{
message
.
error
(
'请完善适用城市信息'
)
}
}
// 删除一条地址
const
removeFormAddress
=
(
idx
:
any
)
=>
{
if
(
requisitionFormAddress
.
length
>
1
)
{
const
requisitionFormAddressFilter
=
requisitionFormAddress
.
filter
((
item
:
any
,
index
:
number
)
=>
index
!==
idx
);
const
cityFilter
=
city
.
filter
((
item
:
any
,
index
:
number
)
=>
index
!==
idx
);
form
.
resetFields
();
requisitionFormAddressFilter
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
const
cityCode
=
code
.
find
(
it
=>
item
.
cityCode
);
if
(
cityCode
!==
item
.
cityCode
)
{
item
.
disabled
=
false
}
form
.
setFieldsValue
({
[
'province_'
+
index
]:
item
.
provinceCode
,
[
'city_'
+
index
]:
item
.
cityCode
});
})
setcity
(
cityFilter
);
setrequisitionFormAddress
(
requisitionFormAddressFilter
);
}
}
useEffect
(()
=>
{
manageProvince
().
then
(
data
=>
{
setprovince
(
data
)
})
},
[])
useEffect
(()
=>
{
/**编辑回显数据 */
if
(
Object
.
keys
(
set
).
length
>
0
)
{
setrequisitionFormAddress
([...
set
.
requisitionFormAddress
])
set
.
requisitionFormAddress
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
PublicApi
.
getManageAreaByPcodeAll
({
pcode
:
item
.
provinceCode
}).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
1000
)
{
city
[
index
]
=
{
citydata
:
res
.
data
}
Promise
.
resolve
().
then
(()
=>
{
setTimeout
(()
=>
{
setcity
([...
city
])
setcode
([...
code
,
item
.
cityCode
])
form
.
setFieldsValue
({
details
:
set
.
details
,
[
'province_'
+
index
]:
item
.
provinceCode
,
[
'city_'
+
index
]:
item
.
cityCode
,
});
},
350
);
});
}
})
})
}
},
[
set
])
useEffect
(()
=>
{
currentRef
.
current
=
{
get
:
()
=>
new
Promise
((
resolve
:
any
)
=>
{
form
.
validateFields
().
then
(
res
=>
{
resolve
({
state
:
true
,
name
:
'basicInfo'
,
data
:
{
details
:
res
.
details
,
requisitionFormAddress
,
}
})
}).
catch
(
error
=>
{
console
.
log
(
error
)
})
})
}
},
[
requisitionFormAddress
])
return
(
<
Form
{
...
layout
}
form=
{
form
}
>
<
Form
.
Item
label=
'需求单摘要'
name=
'details'
rules=
{
[{
required
:
true
,
message
:
'请输入需求单摘要'
}]
}
>
<
Input
/>
</
Form
.
Item
>
<
Form
.
Item
label=
{
<
Tooltip
placement=
"right"
title=
'设置了归属地市后,此商品可根据地市进行筛选,未设置时默认为所有地市'
>
适用地市
<
QuestionCircleOutlined
style=
{
{
marginLeft
:
'5px'
}
}
/></
Tooltip
>
}
style=
{
{
marginBottom
:
'0'
}
}
>
{
requisitionFormAddress
.
map
((
item
:
any
,
idx
:
number
)
=>
{
return
(
<
Row
gutter=
{
10
}
key=
{
`requisitionFormAddress_${idx}_`
}
className=
{
style
.
formwrap
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
name=
{
`province_${idx}`
}
>
<
Select
onDropdownVisibleChange=
{
onDropdownVisibleChange
}
onChange=
{
(
value
)
=>
{
handProvince
(
value
,
idx
,
1
)
}
}
>
{
province
.
map
(
items
=>
{
return
(
<
Option
key=
{
`${items.id}_${idx}_province`
}
value=
{
items
.
code
}
>
{
items
.
name
}
</
Option
>
)
})
}
</
Select
>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
12
}
>
<
Form
.
Item
name=
{
`city_${idx}`
}
>
<
Select
onDropdownVisibleChange=
{
onDropdownVisibleChange
}
onChange=
{
(
value
)
=>
{
handProvince
(
value
,
idx
,
2
)
}
}
>
{
(
item
.
provinceCode
&&
city
.
length
>
0
&&
city
[
idx
])
&&
city
[
idx
].
citydata
.
map
(
items
=>
{
return
(
<
Option
disabled=
{
items
.
disabled
}
key=
{
`${items.id}_${idx}_city`
}
value=
{
items
.
code
}
>
{
items
.
name
}
</
Option
>
)
})
}
</
Select
>
</
Form
.
Item
>
</
Col
>
<
div
className=
{
style
.
formbutton
}
>
{
(
idx
===
requisitionFormAddress
.
length
-
1
)
&&
<
Form
.
Item
>
<
Button
type=
'primary'
onClick=
{
()
=>
addFormAddress
(
idx
)
}
>
+
</
Button
>
</
Form
.
Item
>
}
{
requisitionFormAddress
.
length
>
1
&&
<
Form
.
Item
>
<
Button
onClick=
{
()
=>
removeFormAddress
(
idx
)
}
>
-
</
Button
>
</
Form
.
Item
>
}
</
div
>
</
Row
>
)
})
}
</
Form
.
Item
>
<
Form
.
Item
label=
'需求单号'
>
<
span
>
{
set
.
requisitionFormNo
&&
set
.
requisitionFormNo
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'会员名称'
>
<
span
>
{
set
.
memberName
&&
set
.
memberName
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'单据时间'
>
<
span
>
{
set
.
voucherTime
&&
set
.
voucherTime
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'外部状态'
>
<
span
>
{
set
.
externalState
&&
set
.
externalState
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'内部状态'
>
<
span
>
{
set
.
interiorState
&&
set
.
interiorState
}
</
span
>
</
Form
.
Item
>
</
Form
>
)
}
export
default
BasicInfo
;
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/demandDbutted.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useRef
,
useState
}
from
'react'
;
import
{
Form
,
Radio
,
Tooltip
,
Row
,
Col
,
Checkbox
,
Avatar
,
Space
,
Button
,
Input
}
from
'antd'
;
import
{
QuestionCircleOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
style
from
'./index.less'
;
import
{
StandardTable
}
from
'god'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
GlobalConfig
}
from
'@/global/config'
import
{
PublicApi
}
from
'@/services/api'
;
const
layout
:
any
=
{
colon
:
false
,
labelCol
:
{
style
:
{
width
:
'174px'
}
},
wrapperCol
:
{
span
:
9
},
labelAlign
:
"left"
};
export
interface
faceSetData
{
set
?:
any
,
get
?:
Function
}
const
DemandDbutted
:
React
.
FC
<
faceSetData
>
=
(
props
)
=>
{
const
{
set
,
get
}
=
props
const
[
shopId
,
setShopId
]
=
useState
<
Number
>
(
0
);
const
ref
=
useRef
<
any
>
({});
const
[
filterParams
,
setFilterParams
]
=
useState
<
any
>
({});
const
[
goodAllIds
,
setgoodAllIds
]
=
useState
<
Array
<
any
>>
([]);
// 搜索
const
handleSearch
=
(
val
:
string
)
=>
{
let
obj
=
{
...
filterParams
,
name
:
val
}
setFilterParams
(
obj
)
ref
.
current
.
reload
(
obj
)
}
// 重置
const
handleReset
=
()
=>
{
setFilterParams
({})
setTimeout
(()
=>
{
ref
.
current
.
reload
()
},
500
)
}
// 系统匹配表头
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'序号'
,
key
:
'id'
,
dataIndex
:
'id'
,
},
{
title
:
'会员名称'
,
key
:
'memberName'
,
dataIndex
:
'memberName'
,
},
{
title
:
'会员类型'
,
key
:
'memberTypeName'
,
dataIndex
:
'memberTypeName'
,
},
{
title
:
'会员角色'
,
key
:
'roleName'
,
dataIndex
:
'roleName'
,
},
{
title
:
'会员等级'
,
key
:
'levelTag'
,
dataIndex
:
'levelTag'
,
},
{
title
:
'是否归属会员'
,
key
:
'membershipOrNot'
,
dataIndex
:
'membershipOrNot'
,
},
{
title
:
'状态'
,
key
:
'state'
,
dataIndex
:
'state'
,
},
{
title
:
'操作'
,
key
:
'options'
,
dataIndex
:
'options'
,
},
]
// 指定会员表头
const
memberColumns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'序号'
,
key
:
'memberId'
,
dataIndex
:
'memberId'
,
},
{
title
:
'会员名称'
,
key
:
'name'
,
dataIndex
:
'name'
,
},
{
title
:
'会员类型'
,
key
:
'memberTypeName'
,
dataIndex
:
'memberTypeName'
,
},
{
title
:
'会员角色'
,
key
:
'roleName'
,
dataIndex
:
'roleName'
,
},
{
title
:
'会员等级'
,
key
:
'levelTag'
,
dataIndex
:
'levelTag'
,
}
]
// 选择系统匹配的列表数据
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
Array
<
any
>>
([]);
const
rowSelection
=
{
selectedRowKeys
,
onChange
:
setSelectedRowKeys
};
// 切换添加方式
const
changeRadio
=
(
e
:
any
)
=>
{
const
{
value
}
=
e
.
target
;
if
(
value
===
1
)
{
let
shopList
=
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
type
==
1
).
map
(
v
=>
v
)
setgoodAllIds
(
shopList
)
}
else
{
}
setShopId
(
value
)
}
// 请求系统匹配列表数据
const
fetchSystemMateData
=
(
params
:
any
,
index
:
number
)
=>
{
if
(
index
===
1
)
{
console
.
log
(
params
,
index
)
}
else
if
(
index
===
2
)
{
}
else
{
return
new
Promise
(
resolve
=>
{
PublicApi
.
getMemberManageUpperProviderPage
({
...
filterParams
,
...
params
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
)
}
})
})
}
}
return
(
<
Form
{
...
layout
}
>
<
Form
.
Item
label=
'添加方式'
required
>
<
Radio
.
Group
onChange=
{
changeRadio
}
>
<
Radio
value=
{
1
}
><
Tooltip
placement=
"topLeft"
title=
{
<>
需求发布至企业商城求购频道
</>
}
>
发布类型
<
QuestionCircleOutlined
style=
{
{
marginLeft
:
'5px'
}
}
/></
Tooltip
></
Radio
>
<
Radio
value=
{
2
}
><
Tooltip
placement=
"topLeft"
title=
{
<>
系统通过需求单品类、商品属性、适用地市与平台会员发布的商品品类、商品属性、归属地区进行匹配,推荐满足条件的平台会员
</>
}
>
系统匹配
<
QuestionCircleOutlined
style=
{
{
marginLeft
:
'5px'
}
}
/></
Tooltip
></
Radio
>
<
Radio
value=
{
3
}
><
Tooltip
placement=
"topLeft"
title=
{
<>
选择与当前会员有归属关系的会员且角色类型为服务提供的会员(供应商),需求只发送给指定会员
</>
}
>
指定会员
<
QuestionCircleOutlined
style=
{
{
marginLeft
:
'5px'
}
}
/></
Tooltip
></
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
{
shopId
===
1
&&
// 发布至平台
<
Form
.
Item
label=
'发布至平台'
name=
'shopId'
wrapperCol=
{
{
span
:
24
}
}
>
<
Checkbox
.
Group
className=
{
style
.
checkbox_wrap_style
}
onChange=
{
(
e
)
=>
fetchSystemMateData
(
e
,
1
)
}
>
<
Row
>
{
goodAllIds
.
map
((
v
:
any
,
i
:
number
)
=>
{
console
.
log
(
v
,
1002
)
return
(
<
Col
span=
{
6
}
key=
{
`col_${i}`
}
>
<
Checkbox
value=
{
v
.
id
}
>
<
Space
>
<
Avatar
src=
{
v
.
logoUrl
}
>
LOGO
</
Avatar
>
<
span
>
{
v
.
name
}
</
span
>
</
Space
>
</
Checkbox
>
</
Col
>
)
})
}
</
Row
>
</
Checkbox
.
Group
>
</
Form
.
Item
>
}
{
shopId
===
2
&&
// 系统匹配
<
Form
.
Item
noStyle
>
<
StandardTable
rowSelection=
{
rowSelection
}
columns=
{
columns
}
// fetchTableData=
{(
params
)
=
>
fetchSystemMateData(params)}
/
>
</
Form
.
Item
>
}
{
shopId
===
3
&&
// 指定会员
<
Form
.
Item
noStyle
>
{
/* <Button type='dashed' block style={{ marginBottom: '24px' }}><PlusOutlined />选择会员</Button> */
}
<
StandardTable
tableProps=
{
{
rowKey
:
'id'
,
}
}
currentRef=
{
ref
}
rowSelection=
{
rowSelection
}
columns=
{
memberColumns
}
fetchTableData=
{
(
params
)
=>
fetchSystemMateData
(
params
,
3
)
}
controlRender=
{
<
Row
>
<
Col
span=
{
12
}
>
<
Input
.
Search
style=
{
{
width
:
'256px'
,
marginRight
:
'24px'
,
marginBottom
:
'24px'
}
}
placeholder=
'搜索'
value=
{
filterParams
.
name
}
onChange=
{
(
e
)
=>
setFilterParams
({
...
filterParams
,
name
:
e
.
target
.
value
})
}
onSearch=
{
(
val
)
=>
handleSearch
(
val
)
}
/>
<
Button
onClick=
{
handleReset
}
>
重置
</
Button
>
</
Col
>
</
Row
>
}
/>
</
Form
.
Item
>
}
</
Form
>
)
}
export
default
DemandDbutted
;
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/flowRecord.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'./index.less'
;
import
{
Radio
}
from
'antd'
;
import
PolymericTable
from
'@/components/PolymericTable'
;
import
{
EditableColumns
}
from
'@/components/PolymericTable/interface'
;
import
moment
from
'moment'
;
export
interface
faceSetData
{
set
?:
any
,
get
?:
Function
}
const
FlowRecord
:
React
.
FC
<
faceSetData
>
=
(
props
)
=>
{
const
{
set
,
get
}
=
props
const
[
radio
,
setRadio
]
=
useState
<
string
>
(
'outer'
);
//切换单据
const
format
=
(
text
)
=>
{
return
<>
{
moment
(
text
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
}
</>
}
const
outerColumns
:
EditableColumns
[]
=
[{
title
:
'序号'
,
dataIndex
:
'inquiryListId'
,
render
:
(
texr
:
any
,
record
:
any
,
index
:
number
)
=>
<
span
>
{
index
+
1
}
</
span
>
},
{
title
:
'操作角色'
,
dataIndex
:
'roleName'
,
},
{
title
:
'状态'
,
dataIndex
:
'state'
,
},
{
title
:
'操作'
,
dataIndex
:
'operationalProcess'
,
},
{
title
:
'操作时间'
,
dataIndex
:
'operationTime'
,
render
:
(
text
:
any
,
record
:
any
)
=>
format
(
text
)
},
{
title
:
'审核意见'
,
dataIndex
:
'auditOpinion'
,
}]
const
insideColumns
:
EditableColumns
[]
=
[{
title
:
'序号'
,
dataIndex
:
'inquiryListId'
,
render
:
(
texr
:
any
,
record
:
any
,
index
:
number
)
=>
<
span
>
{
index
+
1
}
</
span
>
},
{
title
:
'操作人'
,
dataIndex
:
'roleName'
,
},
{
title
:
'部门'
,
dataIndex
:
'department'
,
},
{
title
:
'职位'
,
dataIndex
:
'position'
,
},
{
title
:
'状态'
,
dataIndex
:
'state'
,
},
{
title
:
'操作'
,
dataIndex
:
'operationalProcess'
,
},
{
title
:
'操作时间'
,
dataIndex
:
'operationTime'
,
render
:
(
text
:
any
,
record
:
any
)
=>
format
(
text
)
},
{
title
:
'审核意见'
,
dataIndex
:
'auditOpinion'
,
}]
const
onChange
=
(
e
:
any
)
=>
{
setRadio
(
e
.
target
.
value
)
}
return
(
<
div
>
<
Radio
.
Group
defaultValue=
"outer"
buttonStyle=
"solid"
onChange=
{
onChange
}
>
<
Radio
.
Button
value=
"outer"
>
外部单据
</
Radio
.
Button
>
<
Radio
.
Button
value=
"inside"
>
内部单据
</
Radio
.
Button
>
</
Radio
.
Group
>
{
radio
===
'outer'
?
<
PolymericTable
columns=
{
outerColumns
}
loading=
{
false
}
pagination=
{
null
}
dataSource=
{
Object
.
keys
(
set
).
length
>
0
&&
set
.
externalRequisitionFormStateResponses
}
/>
:
<
PolymericTable
columns=
{
insideColumns
}
loading=
{
false
}
pagination=
{
null
}
dataSource=
{
Object
.
keys
(
set
).
length
>
0
&&
set
.
interiorRequisitionFormStateResponses
}
/>
}
</
div
>
)
}
export
default
FlowRecord
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/index.less
0 → 100644
View file @
1154cf80
.formwrap {
position: relative;
.formbutton {
position: absolute;
right: -95px;
display: flex;
width: 90px;
:global {
.ant-form-item {
width: 32px;
margin-right: 10px;
.ant-btn {
width: 32px;
padding: 0;
margin-right: 10px;
}
}
}
}
}
.modal_wrap_className {
.site_layout_background {
background-color: #fff;
border-right: 1px solid #EEF0F3;
}
.site_content_style {
background-color: #fff;
padding: 24px;
height: 600px;
overflow-y: scroll;
.affix_title {
font-size: 14px;
margin-bottom: 24px;
.divider_style {
width: 2px;
height: 16px;
margin: 0px 5px 0px 0px ;
background-color: #00B37A;
}
}
.upload_item {
padding: 5px 8px;
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #FAFBFC;
.upload_left {
display: flex;
align-items: center;
color: #303133;
:global {
.anticon-file-word {
color: #4279df;
font-size: 20px;
margin-right: 8px;
}
}
}
.upload_right {
color: #00B37A;
cursor: pointer;
:global {
.anticon-delete {
margin-left: 19px;
color: #C0C4CC;
}
}
}
}
}
:global {
.ant-anchor-wrapper {
margin-left: 0 !important;
padding-left: 0 !important;
}
.ant-menu-item {
margin-top: 0 !important;
margin-bottom: 0 !important;
&:after {
left: 0;
border-right: none;
border-left: 2px solid #00B37A;
height: 80%;
margin: auto;
}
.ant-anchor-link {
padding: 0px !important;
line-height: 40px !important;
}
}
.ant-menu-item-selected {
color: #303133;
font-weight: 600;
background-color: transparent !important;
}
}
}
.checkbox_wrap_style {
width: 100%;
:global {
.ant-checkbox-wrapper {
width: 100%;
border: 1px solid #ccc;
padding: 8px 18px;
.ant-checkbox {
display: none;
}
> span {
display: flex;
align-items: center;
padding: 0px 0px;
.checkbox_avatar {
width: 32px;
height: 32px;
margin-right: 8px;
}
}
}
.ant-checkbox-wrapper-checked {
border-color: #00b37a!important;
color: #00b37a;
position: relative;
&:after {
content: "";
position: absolute;
width: 12px;
height: 11px;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAALCAYAAABLcGxfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAACwAAAAChLCZNAAAA6klEQVQoFWNgIAVsruliJkr9/1XMDCZqcxkY/mczEtSwv4GD4euvlQz/GfxAavFr2N3Bz/Dz8yaG///tYAbj1rC1QYLh/+8dQMX6MMW4bdjSoMTA8Gs30BlAGhUwoXKBvM21QBN/H0VWbMovzXDSOgOsFFXD1mo7Bsa/B5U5BSVgBoEUrzaOZMi5shkshAjWLTWgUNgINJlnh1k8AysTEzhEQIpDzy5nOP3xKVgDxNNbqxIY/jHMAYqADRBi5WTYY5HEIMbGzRB4ZilcMUgHI8PWqlKg4i6wdiRCgIWDQYSNi+HOt3dIogwMANgLQif9hMeFAAAAAElFTkSuQmCC);
right: 0;
bottom: 0;
}
}
}
}
\ No newline at end of file
src/pages/transaction/demandPosts/demandAdd/components/tradingConditions.tsx
0 → 100644
View file @
1154cf80
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
moment
from
'moment'
;
import
{
Form
,
Input
,
Select
,
Row
,
Col
,
DatePicker
,
message
}
from
'antd'
;
import
{
PublicApi
}
from
'@/services/api'
;
const
layout
:
any
=
{
colon
:
false
,
labelCol
:
{
style
:
{
width
:
'174px'
}
},
wrapperCol
:
{
span
:
24
},
labelAlign
:
"left"
};
export
interface
faceSetData
{
set
?:
any
,
get
?:
Function
,
currentRef
?:
any
}
const
TradingConditions
:
React
.
FC
<
faceSetData
>
=
(
props
)
=>
{
const
{
set
,
get
,
currentRef
}
=
props
const
[
TradingConditionsForm
]
=
Form
.
useForm
();
const
[
address
,
setAddress
]
=
useState
([]);
const
[
selectAddress
,
setselectAddress
]
=
useState
<
any
>
({});
useEffect
(()
=>
{
// 获取交付地址
PublicApi
.
getLogisticsSelectListReceiverAddress
().
then
(
res
=>
{
setAddress
(
res
.
data
)
})
},
[])
useEffect
(()
=>
{
currentRef
.
current
=
{
get
:
()
=>
new
Promise
((
resolve
:
any
)
=>
{
TradingConditionsForm
.
validateFields
().
then
(
res
=>
{
console
.
log
(
res
,
selectAddress
)
resolve
({
state
:
true
,
name
:
'tradingConditions'
,
data
:
{
deliveryTime
:
moment
(
res
.
deliveryTime
).
format
(
'x'
),
quotationAsTime
:
moment
(
res
.
quotationAsTime
).
format
(
'x'
),
addresId
:
res
.
addresId
,
addres
:
selectAddress
.
children
,
logistics
:
res
.
logistics
,
offer
:
res
.
offer
,
otherRequire
:
res
.
otherRequire
,
packRequire
:
res
.
packRequire
,
paymentType
:
res
.
paymentType
,
taxes
:
res
.
taxes
,
}
})
}).
catch
(
error
=>
{
console
.
log
(
error
)
})
})
}
},
[
selectAddress
])
const
disabledDate
=
(
current
)
=>
{
return
current
&&
current
<
moment
().
endOf
(
'day'
);
}
const
onSelect
=
(
val
:
any
,
option
:
any
)
=>
{
console
.
log
(
option
)
setselectAddress
(
option
)
}
useEffect
(()
=>
{
if
(
Object
.
keys
(
set
).
length
>
0
)
{
TradingConditionsForm
.
setFieldsValue
({
deliveryTime
:
moment
(
set
.
deliveryTime
),
addresId
:
set
.
addresId
,
quotationAsTime
:
moment
(
set
.
quotationAsTime
),
offer
:
set
.
offer
,
paymentType
:
set
.
paymentType
,
taxes
:
set
.
taxes
,
logistics
:
set
.
logistics
,
packRequire
:
set
.
packRequire
,
otherRequire
:
set
.
otherRequire
})
setselectAddress
({
children
:
set
.
addres
});
}
},
[
set
])
return
(
<
Form
{
...
layout
}
form=
{
TradingConditionsForm
}
>
<
Row
gutter=
{
70
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
'交付日期'
name=
'deliveryTime'
rules=
{
[{
required
:
true
,
message
:
'请选择交付日期'
}]
}
>
<
DatePicker
style=
{
{
width
:
'100%'
}
}
disabledDate=
{
disabledDate
}
format=
"YYYY-MM-DD HH:mm:ss"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'交付地址'
name=
'addresId'
rules=
{
[{
required
:
true
,
message
:
'请选择交付地址'
}]
}
>
<
Select
onSelect=
{
onSelect
}
>
{
address
.
map
(
v
=>
(
<
Select
.
Option
key=
{
v
.
id
}
value=
{
v
.
id
}
>
{
v
.
fullAddress
}
</
Select
.
Option
>
))
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
'报价截止时间'
name=
'quotationAsTime'
rules=
{
[{
required
:
true
,
message
:
'请选择报价截止时间'
}]
}
>
<
DatePicker
style=
{
{
width
:
'100%'
}
}
format=
"YYYY-MM-DD HH:mm:ss"
disabledDate=
{
disabledDate
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'报价要求'
name=
'offer'
>
<
Input
.
TextArea
placeholder=
'最长100个字符,50个汉字'
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'付款方式'
name=
'paymentType'
>
<
Input
.
TextArea
placeholder=
'最长100个字符,50个汉字'
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'税费要求'
name=
'taxes'
>
<
Input
.
TextArea
placeholder=
'最长100个字符,50个汉字'
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'物流要求'
name=
'logistics'
>
<
Input
.
TextArea
placeholder=
'最长100个字符,50个汉字'
/>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
'包装要求'
name=
'packRequire'
>
<
Input
.
TextArea
placeholder=
'最长100个字符,50个汉字'
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'其他要求'
name=
'otherRequire'
>
<
Input
.
TextArea
placeholder=
'最长100个字符,50个汉字'
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Form
>
)
}
export
default
TradingConditions
\ No newline at end of file
src/pages/transaction/inquiryQuote/components/details.tsx
View file @
1154cf80
...
...
@@ -50,8 +50,8 @@ const Details: React.FC<parmas> = (props) => {
}
/**
* @description: 外部流转记录
* @param {type}
* @return {type}
* @param {type}
* @return {type}
*/
const
externalTextState
=
(
text
)
=>
{
let
name
=
''
...
...
@@ -65,8 +65,8 @@ const Details: React.FC<parmas> = (props) => {
/**
* @description: 内部流转记录
* @param {type}
* @return {type}
* @param {type}
* @return {type}
*/
const
interiorTextState
=
(
text
)
=>
{
let
name
=
''
...
...
@@ -434,9 +434,7 @@ const Details: React.FC<parmas> = (props) => {
{
Object
.
keys
(
data
).
length
>
0
&&
<>
{
(
type
===
'rfq'
?
data
.
externalInquiryListStateResponses
.
length
>
0
:
data
.
externalQuotationStateResponses
.
length
>
0
)
&&
{
type
===
'rfq'
?
<
TabPane
tab=
"外部流转"
key=
"1"
>
<
Steps
style=
{
{
padding
:
'20px 0'
}
}
...
...
@@ -454,27 +452,43 @@ const Details: React.FC<parmas> = (props) => {
})
}
</
Steps
>
</
TabPane
>
}
{
(
type
===
'rfq'
?
data
.
interiorInquiryListLogResponses
.
length
>
0
:
data
.
interiorQuotationStateResponses
.
length
>
0
)
&&
<
TabPane
tab=
"内部流转"
key=
"2"
>
<
Steps
style=
{
{
padding
:
'20px 0'
}
}
progressDot
current=
{
Number
(
data
.
interiorState
-
1
)
}
>
{
detailData
.
interiorStateStep
.
items
.
map
((
item
,
index
)
=>
{
return
(
<
Step
key=
{
index
}
title=
{
item
.
title
}
description=
{
item
.
desc
}
/>
);
})
}
</
Steps
>
</
TabPane
>
:
<>
<
TabPane
tab=
"外部流转"
key=
"1"
>
<
Steps
style=
{
{
padding
:
'20px 0'
}
}
progressDot
current=
{
data
.
externalState
-
1
}
>
{
detailData
.
externalStateStep
.
items
.
map
((
item
,
index
)
=>
{
return
(
<
Step
key=
{
index
}
title=
{
item
.
title
}
description=
{
item
.
desc
}
/>
);
})
}
</
Steps
>
</
TabPane
>
<
TabPane
tab=
"内部流转"
key=
"2"
>
<
Steps
style=
{
{
padding
:
'20px 0'
}
}
progressDot
current=
{
Number
(
data
.
interiorState
-
1
)
}
>
{
detailData
.
interiorStateStep
.
items
.
map
((
item
,
index
)
=>
{
return
(
<
Step
key=
{
index
}
title=
{
item
.
title
}
description=
{
item
.
desc
}
/>
);
})
}
</
Steps
>
</
TabPane
>
</>
}
</>
}
...
...
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