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
linweijiong
jinfa-platform
Commits
3d71db09
Commit
3d71db09
authored
Apr 19, 2021
by
alwayOnlie
Browse files
Options
Browse Files
Download
Plain Diff
订单
parents
f17bb622
a957a9cb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
2181 additions
and
61 deletions
+2181
-61
index.ts
config/routes/tranactionRoute/index.ts
+31
-0
index.tsx
src/components/ModalTable/index.tsx
+5
-2
index.ts
src/components/ModalTable/schema/index.ts
+124
-0
index.ts
src/constants/index.ts
+51
-1
information.tsx
src/pages/contract/manage/add/components/information.tsx
+50
-22
index.ts
src/pages/contract/manage/schema/index.ts
+14
-2
index.ts
...ages/transaction/purchaseOrder/orderCollect/apis/index.ts
+19
-13
index.tsx
...rder/orderCollect/components/contractModalTable/index.tsx
+136
-0
index.tsx
...rder/orderCollect/components/materialModalTable/index.tsx
+221
-0
index.tsx
...Order/orderCollect/components/materialTableCell/index.tsx
+149
-0
index.tsx
...transaction/purchaseOrder/orderCollect/constant/index.tsx
+227
-1
index.ts
...s/transaction/purchaseOrder/orderCollect/effects/index.ts
+7
-6
index.tsx
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
+0
-0
useMaterialTable.tsx
...ion/purchaseOrder/orderCollect/model/useMaterialTable.tsx
+162
-0
index.ts
...es/transaction/purchaseOrder/orderCollect/schema/index.ts
+66
-11
addRule.tsx
src/pages/transaction/purchaseRules/addRule.tsx
+72
-0
RuleSetting.tsx
...ages/transaction/purchaseRules/components/RuleSetting.tsx
+358
-0
index.tsx
...saction/purchaseRules/components/selectProcesss/index.tsx
+125
-0
index.tsx
src/pages/transaction/purchaseRules/effects/index.tsx
+27
-0
index.less
src/pages/transaction/purchaseRules/index.less
+15
-0
index.tsx
src/pages/transaction/purchaseRules/index.tsx
+188
-0
index.tsx
src/pages/transaction/purchaseRules/schema/index.tsx
+126
-0
api.ts
src/services/api.ts
+4
-0
ytt.config.ts
ytt.config.ts
+4
-3
No files found.
config/routes/tranactionRoute/index.ts
View file @
3d71db09
...
...
@@ -242,6 +242,37 @@ const TranactionRoute = {
component
:
'@/pages/transaction/transactionRules/addRule'
,
},
// 采购流程规则配置
{
path
:
'/memberCenter/tranactionAbility/purchaseRules'
,
name
:
'purchaseRules'
,
component
:
'@/pages/transaction/purchaseRules'
,
},
// 新增采购流程规则配置
{
path
:
'/memberCenter/tranactionAbility/purchaseRules/add'
,
name
:
'addRule'
,
hideInMenu
:
true
,
component
:
'@/pages/transaction/purchaseRules/addRule'
,
},
// 编辑采购流程规则配置
{
path
:
'/memberCenter/tranactionAbility/purchaseRules/edit'
,
name
:
'editRule'
,
hideInMenu
:
true
,
component
:
'@/pages/transaction/purchaseRules/addRule'
,
},
// 采购流程规则配置详情
{
path
:
'/memberCenter/tranactionAbility/purchaseRules/detail'
,
name
:
'ruleDetail'
,
hideInMenu
:
true
,
component
:
'@/pages/transaction/purchaseRules/addRule'
,
},
// 供应会员评价管理
{
path
:
'/memberCenter/tranactionAbility/supplierEvaluation'
,
...
...
src/components/ModalTable/index.tsx
View file @
3d71db09
...
...
@@ -3,7 +3,7 @@ import {StandardTable} from 'god';
import
NestTable
from
'@/components/NestTable'
;
import
{
IStandardTableProps
}
from
'god/dist/src/standard-table'
;
import
{
Row
,
Col
,
Modal
}
from
'antd'
;
import
{
productModalSchema
,
productModalByMemberSchema
,
memberModalSchema
,
inquirySchema
,
demandSchema
,
enquirySchema
,
mergeOrderSchema
,
goodsModalSchema
,
demandNumberSchema
,
logisticsDeliverySearchSchema
,
addOrderModalSchema
,
logisticsSelectGoodsSearchSchema
,
SelectRfqOrderSearchSchema
,
SelectLogisticsService
}
from
'./schema'
;
import
{
productModalSchema
,
productModalByMemberSchema
,
memberModalSchema
,
inquirySchema
,
demandSchema
,
enquirySchema
,
mergeOrderSchema
,
goodsModalSchema
,
demandNumberSchema
,
logisticsDeliverySearchSchema
,
addOrderModalSchema
,
logisticsSelectGoodsSearchSchema
,
SelectRfqOrderSearchSchema
,
SelectLogisticsService
,
contractSchema
}
from
'./schema'
;
import
Search
from
'../NiceForm/components/Search'
;
import
SearchSelect
from
'../NiceForm/components/SearchSelect'
;
import
Submit
from
'../NiceForm/components/Submit'
;
...
...
@@ -18,7 +18,7 @@ export interface ModalTableProps extends IStandardTableProps<any> {
cancel
?(),
visible
?:
boolean
,
resetModal
?:
object
,
modalType
?:
'productByDefault'
|
'productByMember'
|
'memberByDefault'
|
'inquiryByDefault'
|
'demandByDefault'
|
'enquiryModel'
|
'MergeOrderByDefault'
|
'goodsModalSchema'
|
'demandNumberSchema'
|
'logisticsDelivery'
|
'addOrderModalSchema'
|
'selectGoodsSchema'
|
'selectRfqOrder'
|
'SelectLogisticsService'
|
'none'
,
modalType
?:
'productByDefault'
|
'productByMember'
|
'memberByDefault'
|
'inquiryByDefault'
|
'demandByDefault'
|
'enquiryModel'
|
'MergeOrderByDefault'
|
'goodsModalSchema'
|
'demandNumberSchema'
|
'logisticsDelivery'
|
'addOrderModalSchema'
|
'selectGoodsSchema'
|
'selectRfqOrder'
|
'SelectLogisticsService'
|
'
contractByDefault'
|
'
none'
,
useNestTable
?:
boolean
,
// 是否使用嵌套表格
nestColumns
?:
any
[],
nestTableProps
?:
any
,
...
...
@@ -91,6 +91,9 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
case
'SelectLogisticsService'
:
{
return
SelectLogisticsService
}
case
'contractByDefault'
:
{
return
contractSchema
}
case
'none'
:
{
return
{}
}
...
...
src/components/ModalTable/schema/index.ts
View file @
3d71db09
...
...
@@ -227,6 +227,64 @@ export const addOrderModalSchema: ISchema = {
}
}
/**
* 新增采购合同订单选择物料的高级筛选
*/
export
const
addContractOrderModalSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
code
:
{
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'请输入物料编号'
,
align
:
'flex-left'
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
rowStyle
:
{
flexWrap
:
'nowrap'
,
style
:
{
marginRight
:
0
}
},
colStyle
:
{
marginTop
:
20
,
},
},
properties
:
{
name
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'物料名称'
,
},
},
type
:
{
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'物料名称'
,
}
},
submit
:
{
"x-component"
:
'Submit'
,
"x-mega-props"
:
{
span
:
1
},
"x-component-props"
:
{
children
:
'查询'
}
}
}
}
}
}
/**
* 货品列表筛选
*/
...
...
@@ -945,3 +1003,69 @@ export const SelectLogisticsService: ISchema = {
}
}
}
/** 选择采购合同弹框筛选 */
export
const
contractSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
contractNo
:
{
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'合同编号'
,
align
:
'flex-left'
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
rowStyle
:
{
flexWrap
:
'nowrap'
,
style
:
{
marginRight
:
0
}
},
colStyle
:
{
marginTop
:
20
,
},
},
properties
:
{
contractAbstract
:
{
type
:
'string'
,
"x-component-props"
:
{
placeholder
:
'合同摘要'
,
style
:
{
width
:
160
}
}
},
partyBName
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'合同乙方'
,
style
:
{
width
:
160
}
},
},
"[startTime,endTime]"
:
{
type
:
'string'
,
"x-component"
:
"dateSelect"
,
"x-component-props"
:
{
placeholder
:
'合同有效时间'
,
}
},
submit
:
{
"x-component"
:
'Submit'
,
"x-mega-props"
:
{
span
:
1
},
"x-component-props"
:
{
children
:
'查询'
}
}
}
}
}
}
src/constants/index.ts
View file @
3d71db09
...
...
@@ -402,7 +402,10 @@ export const ORDER_TYPE = ['',
'渠道直采'
,
'渠道现货'
,
'积分兑换'
,
'渠道积分兑换'
'渠道积分兑换'
,
'采购询价合同'
,
'采购竞价合同'
,
'采购招标合同'
]
// 提货方式
...
...
@@ -515,6 +518,19 @@ export const ORDER_TYPE2_POINTS = 7;
* 渠道积分兑换
*/
export
const
ORDER_TYPE2_CHANNEL_POINTS
=
8
;
/**
* 采购询价合同
*/
export
const
ORDER_TYPE2_ENQUIRY_CONTRACT
=
9
;
/**
* 采购竞价合同
*/
export
const
ORDER_TYPE2_BIDDING_CONTRACT
=
10
;
/**
* 采购招标合同
*/
export
const
ORDER_TYPE2_TENDER_CONTRACT
=
11
;
export
const
ORDER_TYPE2
=
{
[
ORDER_TYPE2_INQUIRY
]:
'询价采购'
,
[
ORDER_TYPE2_DEMAND
]:
'需求采购'
,
...
...
@@ -524,6 +540,9 @@ export const ORDER_TYPE2 = {
[
ORDER_TYPE2_CHANNEL_DIRECT
]:
'渠道直采'
,
[
ORDER_TYPE2_CHANNEL_SPOT
]:
'渠道现货'
,
[
ORDER_TYPE2_CHANNEL_POINTS
]:
'渠道积分兑换'
,
[
ORDER_TYPE2_ENQUIRY_CONTRACT
]:
'采购询价合同'
,
[
ORDER_TYPE2_BIDDING_CONTRACT
]:
'采购竞价合同'
,
[
ORDER_TYPE2_TENDER_CONTRACT
]:
'采购招标合同'
,
};
// 会员角色类型
...
...
@@ -637,6 +656,21 @@ export enum OrderModalType {
* 渠道现货手工下单
*/
CHANNEL_SPOT_MANUAL_ORDER
,
/**
* 采购询价合同下单
*/
PURCHASE_ENQUIRY_CONTRACT_ORDER
=
32
,
/**
* 采购招标合同下单
*/
PURCHASE_TENDER_CONTRACT_ORDER
=
33
,
/**
* 采购竞价合同下单
*/
PURCHASE_BIDDING_CONTRACT_ORDER
=
34
,
}
...
...
@@ -1912,6 +1946,19 @@ export const PAY_WAY_CREDIT = 3;
*/
export
const
PAY_WAY_COD
=
4
;
/**
* 账期
*/
export
const
PAY_WAY_DEADLINE
=
5
;
/**
* 月结
*/
export
const
PAY_WAY_MONTH
=
6
;
/**
* 合同内清算
*/
export
const
PAY_WAY_CONTRACT
=
7
;
/**
* 支付方式对应中文
*/
export
const
PAYWAY
=
{
...
...
@@ -1919,6 +1966,9 @@ export const PAYWAY = {
[
PAY_WAY_OFFLINE
]:
'线下支付'
,
[
PAY_WAY_CREDIT
]:
'授信支付'
,
[
PAY_WAY_COD
]:
'货到付款'
,
[
PAY_WAY_DEADLINE
]:
'账期'
,
[
PAY_WAY_MONTH
]:
'月结'
,
[
PAY_WAY_CONTRACT
]:
'合同内清算'
,
};
...
...
src/pages/contract/manage/add/components/information.tsx
View file @
3d71db09
...
...
@@ -7,7 +7,7 @@ import {
import
{
StandardTable
}
from
'god'
;
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
;
import
moment
from
'moment'
;
import
{
purchaseSchema
}
from
"../../schema"
import
{
purchaseSchema
,
userchema
}
from
"../../schema"
import
{
PublicApi
}
from
'@/services/api'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
Submit
from
'@/components/NiceForm/components/Submit'
...
...
@@ -37,7 +37,9 @@ const Information = (props: any) => {
/**
* @param {{basicsVO}} 表单数据集合
* */
const
[
basicsVO
,
setbasicsVO
]
=
useState
<
any
>
({})
const
[
basicsVO
,
setbasicsVO
]
=
useState
<
any
>
({
})
/**
* @param {{startTime,endTime}} 开始结束时间
* */
...
...
@@ -95,8 +97,10 @@ const Information = (props: any) => {
basicsVO
.
partyBName
=
Row
.
partyBName
?
Row
.
partyBName
:
''
;
basicsVO
.
sourceNo
=
Row
.
sourceNo
?
Row
.
sourceNo
:
''
;
basicsVO
.
totalAmount
=
Row
.
totalAmount
?
Row
.
totalAmount
:
''
;
basicsVO
.
partyBMemberId
=
Row
.
awardRoleId
?
Row
.
awardMemberId
:
''
;
basicsVO
.
partyBRoleId
=
Row
.
awardRoleId
?
Row
.
awardRoleId
:
''
;
setbasicsVO
(
basicsVO
)
console
.
log
(
basicsVO
,
Row
)
console
.
log
(
Row
,
1111111111111111111
)
attrValueForm
.
setFieldsValue
(
basicsVO
)
setfalg
(
Row
.
sourceNo
?
true
:
false
)
setmanual
(
Row
.
partyBName
?
true
:
false
)
...
...
@@ -106,7 +110,7 @@ const Information = (props: any) => {
* @function fetchData 容需求发布
**/
const
fetchData
=
(
params
:
any
)
=>
{
ctx
()
let
fn
;
switch
(
basicsVO
.
sourceType
)
{
case
'1'
:
...
...
@@ -171,6 +175,7 @@ const Information = (props: any) => {
basicsVO
.
partyBName
=
partyBName
;
basicsVO
.
partyBMemberId
=
partyBMemberId
;
basicsVO
.
sourceNo
=
sourceNo
;
basicsVO
.
partyBRoleId
=
partyBRoleId
;
setbasicsVO
(
basicsVO
)
setmanual
(
true
)
// getType(false)
...
...
@@ -198,6 +203,46 @@ const Information = (props: any) => {
})
}
})
/* 根据 sourceType 设置搜索内容 */
const
ctx
=
()
=>
{
if
(
basicsVO
.
sourceType
==
1
)
{
let
data
=
{
ctx
:
{
inline
:
false
,
schema
:
purchaseSchema
,
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'demandNO'
,
FORM_FILTER_PATH
,
);
},
components
:
{
DateRangePickerUnix
,
Submit
}
}
}
return
data
;
}
else
{
let
data
=
{
ctx
:
{
inline
:
false
,
schema
:
userchema
,
components
:
{
DateRangePickerUnix
,
Submit
}
}
}
console
.
log
(
'===================================='
);
console
.
log
(
data
);
console
.
log
(
'===================================='
);
return
data
;
}
}
return
(
<
div
>
<
Form
...
...
@@ -348,24 +393,7 @@ const Information = (props: any) => {
currentRef=
{
refs
}
rowSelection=
{
rowSelection
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
formilyProps=
{
{
ctx
:
{
inline
:
false
,
schema
:
purchaseSchema
,
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'demandNO'
,
FORM_FILTER_PATH
,
);
},
components
:
{
DateRangePickerUnix
,
Submit
}
}
}
}
formilyProps=
{
ctx
()
}
/>
</
Drawer
>
</
div
>
...
...
src/pages/contract/manage/schema/index.ts
View file @
3d71db09
...
...
@@ -267,8 +267,20 @@ export const purchaseSchema: any = {
},
}
}
/* 用户会员 */
export
const
userchema
:
any
=
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
'x-component-props'
:
{
placeholder
:
'请输入搜索内容'
,
align
:
'start'
,
},
},
}
}
/**
* 合同管理合同查询
*/
...
...
src/pages/transaction/purchaseOrder/orderCollect/apis/index.ts
View file @
3d71db09
import
{
PublicApi
}
from
'@/services/api'
export
const
fetchOrderApi
=
{
/
/ 弹窗获取商品列表
/
** 弹窗获取商品列表 */
async
getProductList
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getProductCommodityCommonGetCommodityListByBuyer
(
params
,
{
useCache
:
true
,
ttl
:
10
*
1000
})
return
data
},
/
/ 弹窗获取询价报价单列表
/
** 弹窗获取询价报价单列表 */
async
getQuotationList
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getTransactionProductQuotationList
(
params
)
return
data
},
/
/ 弹窗获取需求报价单列表
/
** 弹窗获取需求报价单列表 */
async
getOrderQuotationDemandList
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getOrderQuotationList
(
params
)
return
data
},
/
/ 根据询价报价id查询商品列表
/
** 根据询价报价id查询商品列表 */
async
getProductListByQuotationOrderId
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getTransactionEnquiryProductAll
(
params
)
return
data
},
/
/ 根据需求报价id查询商品列表
/
** 根据需求报价id查询商品列表 */
async
getProductListByDemandOrderId
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getOrderQuotationParticularsProductList
(
params
)
return
data
},
/
/ 根据下单类型获取会员列表
/
** 根据下单类型获取会员列表 */
async
getMemberListByModelType
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getMemberManageAllPageByordertype
(
params
)
return
data
},
/
/ 获取所有商品收货地址
/
** 获取所有商品收货地址 */
async
getProductAddressAll
()
{
const
{
data
}
=
await
PublicApi
.
getLogisticsSelectListReceiverAddress
()
return
data
},
/
/ 获取发票列表
/
** 获取发票列表 */
async
getInvoicesList
()
{
const
{
data
}
=
await
PublicApi
.
getSettleAccountsInvoiceMessageList
()
return
data
},
/
/ 获取支付信息列表
/
** 获取支付信息列表 */
async
getPayInfoList
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getOrderInitializationPaymentInformation
(
params
)
return
data
},
/
/ 查询当前订单工作流
/
** 查询当前订单工作流 */
async
getOrderWorkFlow
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getOrderTradingRulesByProductId
(
params
)
return
data
},
/
/
根据合同模板id查询合同模板详情
/
**
根据合同模板id查询合同模板详情
// async getContractDetail(params) {
// const { data } = await PublicApi.getContractContractTemplateGet(params)
// return data
// },
/
/ 生成电子合同
/
** 生成电子合同 */
async
createContract
(
params
)
{
const
{
data
}
=
await
PublicApi
.
postContractContractSignProcurementSignContractCreate
(
params
,
{
ctlType
:
"none"
})
return
data
},
/
/ 获取合并订单列表
/
** 获取合并订单列表 */
async
getMergeOrderList
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getOrderMergeOrderList
(
params
)
return
data
},
/** 合同下单 获取合同采购物料 */
async
getContractPurchaseMaterielList
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getContractManagePagePurchaseMaterielList
(
params
)
return
data
},
}
src/pages/transaction/purchaseOrder/orderCollect/components/contractModalTable/index.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
useEffect
,
useState
}
from
'react'
import
ModalTable
,
{
ModalTableProps
}
from
'@/components/ModalTable'
import
{
fetchOrderApi
}
from
'../../apis'
import
{
useModalTable
}
from
'../../model/useModalTable'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
contractColumns
}
from
'../../constant'
import
{
PublicApi
}
from
'@/services/api'
import
{
filterProductDataById
}
from
'../productModalTable'
import
{
OrderModalType
}
from
'@/constants'
export
interface
ContractModalTableProps
extends
ModalTableProps
{
type
?:
'radio'
|
'checkbox'
,
schemaAction
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
currentRef
?:
any
,
confirmModal
?()
}
// 选择采购合同弹窗
const
ContractModalTable
:
React
.
FC
<
ContractModalTableProps
>
=
(
props
)
=>
{
const
{
type
=
'radio'
,
schemaAction
,
confirmModal
,
currentRef
,
...
restProps
}
=
props
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
useModalTable
({
type
})
const
[
originType
,
setOriginType
]
=
useState
<
number
>
()
useEffect
(()
=>
{
if
(
currentRef
)
{
currentRef
.
current
=
{
setVisible
,
visible
,
rowSelectionCtl
}
}
},
[])
useEffect
(()
=>
{
if
(
visible
)
{
/** 这里分 询价 竞价 招标 三种采购合同类型 */
let
sourceType
=
null
;
switch
(
schemaAction
.
getFieldValue
(
'orderModel'
))
{
case
OrderModalType
.
PURCHASE_BIDDING_CONTRACT_ORDER
:
sourceType
=
3
;
break
;
case
OrderModalType
.
PURCHASE_ENQUIRY_CONTRACT_ORDER
:
sourceType
=
1
;
break
;
case
OrderModalType
.
PURCHASE_TENDER_CONTRACT_ORDER
:
sourceType
=
2
;
break
;
}
setOriginType
(
sourceType
)
}
},
[
visible
])
const
handleConfirm
=
async
()
=>
{
const
item
=
rowSelectionCtl
.
selectRow
[
0
]
if
(
item
)
{
schemaAction
.
setFieldValue
(
'quotationNo'
,
item
.
contractNo
)
const
{
data
}
=
await
fetchOrderApi
.
getContractPurchaseMaterielList
({
contractId
:
item
.
id
,
current
:
1
,
pageSize
:
999
,
})
if
(
!
data
)
{
return
false
;
}
// // 判断所选择的商品是否属于同一个工作流
// const res = await PublicApi.postOrderIsWorkFlow({
// memberId: data[0].memberId,
// memberRoleId: data[0].memberRoleId,
// productIds: data.map(item => item.productId),
// orderModel: schemaAction.getFieldValue('orderModel')
// }, { ctlType: 'none' })
// 字段转换
let
newData
=
data
.
map
((
v
:
any
)
=>
{
let
temp
:
any
=
{};
temp
.
id
=
v
.
id
;
temp
.
code
=
v
.
materielNo
;
temp
.
name
=
v
.
materielName
;
temp
.
type
=
v
.
type
;
temp
.
category
=
v
.
category
;
temp
.
brand
=
v
.
brand
;
temp
.
unit
=
v
.
unit
;
// temp.relevanceGoods = v.associatedGoods;
temp
.
relevanceProductId
=
v
.
associatedDataId
;
temp
.
relevanceProductName
=
v
.
associatedGoods
;
temp
.
relevanceProductNo
=
v
.
associatedMaterielNo
;
temp
.
relevanceProductType
=
v
.
associatedType
;
temp
.
relevanceProductCategory
=
v
.
associatedCategory
;
temp
.
relevanceProductBrand
=
v
.
associatedBrand
;
temp
.
price
=
v
.
price
;
temp
.
inventory
=
v
.
bidCount
;
// temp.purchaseCount = v.purchaseCount;
temp
.
taxInclusive
=
v
.
isHasTax
;
temp
.
taxRate
=
v
.
taxRate
;
// @ 配送方式 默认物流
temp
.
logistics
=
1
// 会员信息冗余
temp
.
memberId
=
item
.
partyBMemberId
temp
.
memberRoleId
=
item
.
partyBRoleId
return
temp
})
// 把地址信息冗余给商品字段render
// schemaAction.setFieldValue('orderProductRequests', await filterProductDataById([], data))
schemaAction
.
setFieldValue
(
'orderProductRequests'
,
newData
)
schemaAction
.
setFieldValue
(
'supplyMembersName'
,
item
.
partyBName
)
schemaAction
.
setFieldValue
(
'supplyMembersId'
,
item
.
partyBMemberId
)
schemaAction
.
setFieldValue
(
'supplyMembersRoleId'
,
item
.
partyBRoleId
)
schemaAction
.
setFieldValue
(
'orderThe'
,
item
.
contractAbstract
)
schemaAction
.
setFieldValue
(
'contractId'
,
item
.
id
)
}
confirmModal
&&
confirmModal
()
setVisible
(
false
)
}
return
(
<
ModalTable
modalTitle=
'选择采购合同'
columns=
{
contractColumns
}
visible=
{
visible
}
confirm=
{
handleConfirm
}
cancel=
{
()
=>
setVisible
(
false
)
}
fetchTableData=
{
async
(
params
)
=>
(
await
PublicApi
.
getContractManagePageCompleteList
({...
params
,
sourceType
:
originType
},
{
useCache
:
true
,
ttl
:
10
*
1000
})).
data
}
rowSelection=
{
rowSelection
}
modalType=
'contractByDefault'
searchName=
"contractNo"
tableProps=
{
{
rowKey
:
'id'
}
}
{
...
restProps
}
/>
)
}
ContractModalTable
.
defaultProps
=
{}
export
default
ContractModalTable
src/pages/transaction/purchaseOrder/orderCollect/components/materialModalTable/index.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
useEffect
}
from
'react'
import
ModalTable
,
{
ModalTableProps
}
from
'@/components/ModalTable'
import
{
fetchOrderApi
}
from
'../../apis'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
DELIVERY_TYPE
}
from
'@/constants'
import
{
PublicApi
}
from
'@/services/api'
import
{
EnvironmentOutlined
}
from
'@ant-design/icons'
import
{
Popover
,
Space
,
Row
,
message
}
from
'antd'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
addContractOrderModalSchema
}
from
'@/components/ModalTable/schema'
import
Search
from
'@/components/NiceForm/components/Search'
import
Submit
from
'@/components/NiceForm/components/Submit'
;
export
interface
MaterialModalTableProps
extends
ModalTableProps
{
type
?:
'radio'
|
'checkbox'
,
schemaAction
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
currentRef
?:
any
,
sectionProps
:
any
,
confirmModal
?()
}
export
const
materialColumns
:
any
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'物料编号'
,
dataIndex
:
'materielNo'
,
align
:
'center'
,
key
:
'materielNo'
,
},
{
title
:
'物料名称'
,
dataIndex
:
'materielName'
,
align
:
'center'
,
key
:
'materielName'
,
},
{
title
:
'品类'
,
dataIndex
:
'category'
,
align
:
'center'
,
key
:
'category'
,
},
{
title
:
'品牌'
,
dataIndex
:
'brand'
,
align
:
'center'
,
key
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unit'
,
align
:
'center'
,
key
:
'unit'
},
{
title
:
'合同剩余'
,
dataIndex
:
'bidCount'
,
align
:
'center'
,
key
:
'bidCount'
},
{
title
:
'供方库存'
,
dataIndex
:
'bidCount'
,
align
:
'center'
,
key
:
'bidCount'
},
]
export
const
AddressPop
=
(
props
)
=>
{
const
{
pickInfo
=
null
,
children
}
=
props
let
receiveInfo
=
pickInfo
?.
render
&&
JSON
.
parse
(
pickInfo
.
render
)
return
pickInfo
&&
pickInfo
.
deliveryType
===
2
?
<
Space
>
<
EnvironmentOutlined
style=
{
{
marginRight
:
8
}
}
/>
<
Popover
content=
{
<
Row
>
<
div
>
<
h3
><
EnvironmentOutlined
/>
自提地址
</
h3
>
{
/* <p>{pickInfo.receiverName} / {pickInfo.phone}</p>
<p>{pickInfo.fullAddress}</p> */
}
{
receiveInfo
&&
<>
<
p
>
{
receiveInfo
.
shipperName
}
/
{
receiveInfo
.
phone
}
</
p
>
<
p
>
{
receiveInfo
.
provinceName
+
receiveInfo
.
cityName
+
receiveInfo
.
districtName
+
receiveInfo
.
address
}
</
p
>
</>
}
</
div
>
</
Row
>
}
>
{
children
}
</
Popover
>
</
Space
>
:
children
}
export
const
filterProductDataById
=
(
data
,
targetData
)
=>
{
return
targetData
.
reduce
(
async
(
prev
:
any
[],
next
)
=>
{
const
{
logistics
}
=
next
// 由于自选商品和进货单商品字段不一致,需手动同步
next
.
brand
=
next
.
brand
||
next
.
brandName
next
.
category
=
next
.
category
||
next
.
customerCategoryName
next
.
unit
=
next
.
unit
||
next
.
unitName
next
.
productName
=
next
.
productName
||
next
.
name
if
(
logistics
.
deliveryType
===
2
&&
logistics
.
sendAddress
)
{
const
{
code
,
data
}
=
await
PublicApi
.
getLogisticsShipperAddressGet
({
id
:
logistics
.
sendAddress
},
{
ttl
:
60
*
1000
,
useCache
:
true
})
logistics
.
render
=
data
}
else
{
logistics
.
render
=
DELIVERY_TYPE
[
logistics
.
deliveryType
]
}
// 配送方式外置, 用于接口字段冗余
next
.
deliveryType
=
logistics
.
deliveryType
// id 存在集合中, 采用target中的数据, 否则采用data中的数据
const
findResult
=
data
.
find
(
v
=>
v
.
id
===
next
.
id
)
// 由于迭代时,会出现promise的 已完成状态, 需转换一下,实现异步转同步化
if
(
!
Array
.
isArray
(
prev
))
{
prev
=
await
prev
}
if
(
findResult
)
{
// 已经选中过这一项, 则需要采用原有的商品列表
prev
.
push
(
findResult
)
}
else
{
prev
.
push
(
next
)
}
return
prev
},
[])
}
const
MaterialModalTable
:
React
.
FC
<
MaterialModalTableProps
>
=
(
props
)
=>
{
const
{
type
=
'checkbox'
,
schemaAction
,
confirmModal
,
currentRef
,
sectionProps
,
...
restProps
}
=
props
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
sectionProps
useEffect
(()
=>
{
if
(
currentRef
)
{
currentRef
.
current
=
{
setVisible
,
visible
,
rowSelectionCtl
}
}
},
[])
const
handleConfirm
=
async
()
=>
{
// 判断所选择的商品是否属于同一个工作流
// @ts-ignore
const
res
=
await
PublicApi
.
postOrderIsWorkFlow
({
memberId
:
rowSelectionCtl
.
selectRow
[
0
].
memberId
,
memberRoleId
:
rowSelectionCtl
.
selectRow
[
0
].
memberRoleId
,
productIds
:
rowSelectionCtl
.
selectedRowKeys
,
orderModel
:
schemaAction
.
getFieldValue
(
'orderModel'
)
},
{
ctlType
:
'none'
})
if
(
res
.
code
===
1000
)
{
const
productData
=
schemaAction
.
getFieldValue
(
'orderProductRequests'
)
schemaAction
.
setFieldValue
(
'orderProductRequests'
,
await
filterProductDataById
(
productData
,
rowSelectionCtl
.
selectRow
))
confirmModal
&&
confirmModal
()
setVisible
(
false
)
}
else
{
message
.
error
(
res
.
message
)
}
}
const
fetchMaterialList
=
(
values
)
=>
{
const
contractId
=
schemaAction
.
getFieldValue
(
'contractId'
)
const
params
=
{
...
values
,
contractId
,
}
return
fetchOrderApi
.
getProductList
(
params
)
}
return
(
<
ModalTable
modalTitle=
'选择采购物料'
width=
{
900
}
columns=
{
materialColumns
}
visible=
{
visible
}
confirm=
{
handleConfirm
}
cancel=
{
()
=>
setVisible
(
false
)
}
fetchTableData=
{
fetchMaterialList
}
rowSelection=
{
rowSelection
}
resetModal=
{
{
destroyOnClose
:
true
,
forceRender
:
true
}
}
modalType=
'none'
tableProps=
{
{
rowKey
:
'id'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
rowSelectionCtl
.
appendSelectRow
(
record
);
rowSelectionCtl
.
appendSelectRowKeys
(
record
.
id
);
},
})
}
}
formilyProps=
{
{
ctx
:
{
schema
:
addContractOrderModalSchema
,
components
:
{
ModalSearch
:
Search
,
Submit
},
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'code'
,
FORM_FILTER_PATH
,
);
}
}
}
}
{
...
restProps
}
/>
)
}
MaterialModalTable
.
defaultProps
=
{}
export
default
MaterialModalTable
src/pages/transaction/purchaseOrder/orderCollect/components/materialTableCell/index.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
useState
,
useRef
,
useContext
,
useEffect
}
from
'react'
import
{
Form
,
Input
,
Select
}
from
'antd'
;
export
interface
MaterialTableCellProps
{
title
:
React
.
ReactNode
;
editable
:
boolean
;
children
:
React
.
ReactNode
;
dataIndex
:
string
;
record
:
any
;
handleSave
:
(
record
:
any
)
=>
Promise
<
any
>
;
forceEdit
:
boolean
,
formItem
:
string
,
formItemProps
:
any
,
}
const
EditableContext
=
React
.
createContext
<
any
>
({});
export
const
MaterialEditableRow
:
React
.
FC
<
any
>
=
({...
props
})
=>
{
const
[
form
]
=
Form
.
useForm
();
const
ctx
=
{
form
}
return
(
<
Form
form=
{
form
}
component=
{
false
}
>
<
EditableContext
.
Provider
value=
{
ctx
}
>
<
tr
{
...
props
}
/>
</
EditableContext
.
Provider
>
</
Form
>
);
};
export
const
MaterialTableCell
:
React
.
FC
<
MaterialTableCellProps
>
=
({
title
,
editable
,
children
,
dataIndex
,
record
,
handleSave
,
forceEdit
,
formItem
,
formItemProps
=
{},
...
restProps
})
=>
{
const
formItemRef
=
useRef
<
any
>
();
const
{
form
}
=
useContext
(
EditableContext
);
const
save
=
async
e
=>
{
try
{
const
values
=
await
form
.
validateFields
();
values
.
purchaseCount
=
Number
(
values
.
purchaseCount
)
||
0
handleSave
({
...
record
,
...
values
});
}
catch
(
errInfo
)
{
console
.
log
(
'Save failed:'
,
errInfo
);
}
};
// select的change
const
change
=
async
(
va
,
op
,
idx
)
=>
{
console
.
log
(
va
,
op
,
idx
)
// try {
// const values = await form.validateFields();
// values[idx] = op['label']
// values['unitId'] = op['value']
// handleSave({ ...record, ...values });
// } catch (errInfo) {
// console.log('Save failed:', errInfo);
// }
}
const
chooseFormItem
=
(
type
,
v
)
=>
{
switch
(
type
)
{
// input类型
case
'input'
:
{
return
<
Input
style=
{
{
width
:
80
}
}
type=
'number'
ref=
{
formItemRef
}
onChange=
{
save
}
{
...
formItemProps
}
id=
{
dataIndex
+
record
.
id
}
className=
"purchase_amount_input"
/>
}
// select选择类型
case
'select'
:
{
return
<
Select
style=
{
{
width
:
80
}
}
ref=
{
formItemRef
}
onChange=
{
(
value
,
option
)
=>
change
(
value
,
option
,
dataIndex
)
}
id=
{
dataIndex
+
record
.
id
}
className=
"purchase_logistic_select"
options=
{
[{
label
:
'物流'
,
value
:
1
},
{
label
:
'自提'
,
value
:
2
},
{
label
:
'无需配送'
,
value
:
3
}]
}
{
...
formItemProps
}
/>
}
}
}
// 校验最小起订
const
validatorNumber
=
(
rule
,
value
,
callback
)
=>
{
try
{
let
_value
=
Number
(
value
)
if
(
isNaN
(
_value
)
||
_value
<
Number
(
record
[
"minOrder"
]))
{
throw
new
Error
(
`数量不小于最小起订数
${
record
[
"minOrder"
]}
`
)
}
callback
()
}
catch
(
err
)
{
callback
(
err
)
}
}
let
childNode
=
children
;
if
(
editable
)
{
childNode
=
<
Form
.
Item
style=
{
{
margin
:
0
}
}
name=
{
dataIndex
}
initialValue=
{
record
[
dataIndex
]
||
''
}
rules=
{
dataIndex
===
'purchaseCount'
?
[
{
required
:
true
,
message
:
`${title}必须填写`
,
},
{
pattern
:
/^
\d
+
(\.\d
{1,3}
)?
$/
,
message
:
'采购数量仅限三位小数'
,
},
{
validator
:
validatorNumber
},
]
:
[
{
required
:
true
,
message
:
`${title}必须填写`
,
}
]
}
>
{
chooseFormItem
(
formItem
,
record
[
dataIndex
]
||
''
)
}
</
Form
.
Item
>
}
return
<
td
{
...
restProps
}
>
{
childNode
}
</
td
>;
}
MaterialTableCell
.
defaultProps
=
{}
export
default
MaterialTableCell
src/pages/transaction/purchaseOrder/orderCollect/constant/index.tsx
View file @
3d71db09
...
...
@@ -25,7 +25,27 @@ export const PriceComp = (props) => {
</
div
>
}
// @采购合同下单 字段转换
export
const
procurementProcessField
=
(
value
)
=>
{
value
.
orderProductRequests
=
value
.
orderProductRequests
.
map
(
item
=>
{
// @todo 查询商品对应的最小起订数
// const { data, code } = await PublicApi.getProductCommodityGetCommodity({id: item.relevanceProductId})
delete
item
.
id
return
{
...
item
,
productId
:
item
.
relevanceProductId
,
productName
:
item
.
relevanceProductName
,
brand
:
item
.
relevanceProductBrand
,
category
:
item
.
relevanceProductCategory
,
unit
:
item
.
unit
,
price
:
item
.
unitPrice
,
deliveryType
:
item
.
logistics
.
deliveryType
,
// @todo 后端暂无返回 写死1
minOrder
:
1
,
}
})
return
value
}
/***********控制订单模式联动其他字段的数组集合 *******/
export
const
orderCombination
=
{
...
...
@@ -47,6 +67,12 @@ export const orderCombination = {
OrderModalType
.
DEMAND_QUOTATION_ORDER
,
OrderModalType
.
CONSOLIDATED_ORDER
,
],
// 是否显示选择采购合同按钮
showPurchaseContract
:
[
OrderModalType
.
PURCHASE_ENQUIRY_CONTRACT_ORDER
,
OrderModalType
.
PURCHASE_TENDER_CONTRACT_ORDER
,
OrderModalType
.
PURCHASE_BIDDING_CONTRACT_ORDER
],
// 是否显示供应会员按钮
showSupplyMembersNameBtn
:
[
OrderModalType
.
HAND_ORDER
,
...
...
@@ -81,8 +107,28 @@ export const orderTypeLabel = ['',
'渠道直采'
,
'渠道现货'
,
'渠道现货'
,
// '采购询价合同',
// '采购竞价合同',
// '采购招标合同',
]
export
const
orderTypeLabelMap
=
{
"5"
:
"现货采购"
,
"6"
:
"现货采购"
,
"7"
:
"询价采购"
,
"8"
:
"需求采购"
,
"9"
:
"集采"
,
"10"
:
"渠道直采"
,
"11"
:
"渠道直采"
,
"12"
:
"渠道现货"
,
"13"
:
"渠道现货"
,
// "24": "积分兑换",
// "25": "渠道积分兑换",
"32"
:
"采购询价合同"
,
"33"
:
"采购竞价合同"
,
"34"
:
"采购招标合同"
,
}
// 支付方式
export
const
payTypeLabel
=
[
{
...
...
@@ -101,6 +147,18 @@ export const payTypeLabel = [
label
:
'货到付款'
,
value
:
4
},
{
label
:
'账期'
,
value
:
5
},
{
label
:
'月结'
,
value
:
6
},
{
label
:
'合同内清算'
,
value
:
7
},
]
export
const
memberColumns
:
any
[]
=
[
...
...
@@ -170,6 +228,61 @@ export const inquiryColumns: any[] = [
}
]
// 采购合同下单选合同列
export
const
contractColumns
:
any
[]
=
[
{
title
:
'Id'
,
dataIndex
:
'id'
,
key
:
'id'
,
className
:
'commonHide'
},
{
title
:
'合同编号'
,
dataIndex
:
'contractNo'
,
key
:
'contractNo'
,
},
{
title
:
'合同摘要'
,
dataIndex
:
'contractAbstract'
,
key
:
'contractAbstract'
,
},
{
title
:
'合同生效时间'
,
dataIndex
:
'startTime'
,
key
:
'startTime'
,
},
{
title
:
'合同失效时间'
,
dataIndex
:
'endTime'
,
key
:
'endTime'
,
},
{
title
:
'合同乙方'
,
dataIndex
:
'partyBName'
,
key
:
'partyBName'
,
},
{
title
:
'合同剩余金额'
,
dataIndex
:
'freeAmount'
,
key
:
'freeAmount'
,
},
{
title
:
'寻源类型'
,
dataIndex
:
'sourceType'
,
key
:
'sourceType'
,
render
:
(
t
,
r
)
=>
{
if
(
t
===
1
)
return
'采购询价'
if
(
t
===
2
)
return
'采购招标'
if
(
t
===
3
)
return
'采购竞价'
}
},
{
title
:
'对应单据'
,
dataIndex
:
'sourceNo'
,
key
:
'sourceNo'
,
}
]
export
const
paymentInformationColumns
:
any
[]
=
[
{
title
:
'支付次数'
,
...
...
@@ -339,6 +452,119 @@ export const productInfoColumns: any[] = [
},
]
// 合同下单 物料列表
export
const
materialInfoColumns
:
any
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
className
:
'commonHide'
},
{
title
:
'物料编号'
,
dataIndex
:
'code'
,
align
:
'center'
,
key
:
'code'
,
},
{
title
:
'物料名称/规格'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
render
:
(
t
,
r
)
=>
`
${
t
}
/
${
r
.
type
}
`
},
{
title
:
'品类'
,
dataIndex
:
'category'
,
align
:
'center'
,
key
:
'category'
,
},
{
title
:
'品牌'
,
dataIndex
:
'brand'
,
align
:
'center'
,
key
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unit'
,
align
:
'center'
,
key
:
'unit'
,
},
{
title
:
'关联报价商品ID/名称/规格/品类/品牌'
,
dataIndex
:
'relevanceProductId'
,
align
:
'center'
,
key
:
'relevanceProductId'
,
render
:
(
t
,
r
)
=>
`
${
t
}
/
${
r
.
relevanceProductName
}
/
${
r
.
relevanceProductCategory
}
/
${
r
.
relevanceProductBrand
}
`
},
{
title
:
'单价(元)'
,
dataIndex
:
'price'
,
align
:
'left'
,
key
:
'price'
,
},
{
title
:
'供方库存'
,
dataIndex
:
'inventory'
,
align
:
'center'
,
key
:
'inventory'
,
},
{
title
:
'采购数量'
,
dataIndex
:
'purchaseCount'
,
align
:
'center'
,
key
:
'purchaseCount'
,
formItem
:
'input'
,
editable
:
true
,
width
:
80
},
{
title
:
'含税'
,
dataIndex
:
'taxInclusive'
,
align
:
'center'
,
key
:
'taxInclusive'
,
render
:
(
t
,
r
)
=>
t
?
'是'
:
'否'
},
{
title
:
'税率'
,
dataIndex
:
'taxRate'
,
align
:
'center'
,
key
:
'taxRate'
,
},
{
title
:
'金额'
,
dataIndex
:
'money'
,
align
:
'center'
,
key
:
'money'
,
},
// 接口调用
{
title
:
'配送方式'
,
dataIndex
:
'logistics'
,
align
:
'center'
,
key
:
'logistics'
,
formItem
:
'select'
,
editable
:
true
,
width
:
80
// render: (t, r) => {
// if(r.logistics?.deliveryType === 1)
// return "物流(默认)"
// else if(r.logistics?.deliveryType === 2)
// return "自提"
// else if(r.logistics?.deliveryType === 3)
// return "无需配送"
// }
},
{
title
:
'操作'
,
dataIndex
:
'ctl'
,
align
:
'center'
,
key
:
'ctl'
,
},
]
// 合并订单父级表格列
export
const
mergeParentTableColumns
:
any
[]
=
[
{
...
...
src/pages/transaction/purchaseOrder/orderCollect/effects/index.ts
View file @
3d71db09
...
...
@@ -2,7 +2,7 @@ import { parmas } from './../../../inquiryQuote/components/reviewList';
import
{
ISchemaFormActions
,
FormEffectHooks
,
IFieldState
,
ISchemaFormAsyncActions
,
createEffectHook
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
{
orderCombination
}
from
'../constant'
;
import
{
orderCombination
,
orderTypeLabelMap
}
from
'../constant'
;
import
{
history
}
from
'umi'
;
import
{
fetchOrderApi
}
from
'../apis'
;
import
{
PublicApi
}
from
'@/services/api'
;
...
...
@@ -25,7 +25,8 @@ const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsync
state
.
loading
=
true
})
// 折扣请求
const
asyncPriceRequests
:
any
[]
=
await
Promise
.
all
(
productData
.
filter
(
v
=>
v
.
memberPrice
===
undefined
).
map
(
async
v
=>
{
// @采购合同模式下单 不考虑会员折扣
const
asyncPriceRequests
:
any
[]
=
ctx
.
getFieldValue
(
'orderModel'
)
<
OrderModalType
.
PURCHASE_ENQUIRY_CONTRACT_ORDER
?
await
Promise
.
all
(
productData
.
filter
(
v
=>
v
.
memberPrice
===
undefined
).
map
(
async
v
=>
{
const
{
code
,
data
}
=
await
PublicApi
.
getMemberManageUpperCreditParamGet
({
parentMemberId
:
v
.
memberId
,
parentMemberRoleId
:
v
.
memberRoleId
...
...
@@ -33,7 +34,7 @@ const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsync
// return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
return
code
===
1000
?
{
value
:
data
.
parameter
,
id
:
v
.
id
}
:
{
value
:
''
,
id
:
0
}
}
))
))
:
[]
// const asyncAddressRequests = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => {
// const {code, data} = await PublicApi.getLogisticsShipperAddressGet({
...
...
@@ -105,7 +106,7 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
const
productItem
=
value
[
0
]
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
// 编辑下 支付信息联动实现
}
else
if
(
pageStatus
===
PageStatus
.
ADD
)
{
// 新增下 需要支付信息生成支付次数
}
else
if
(
pageStatus
===
PageStatus
.
ADD
&&
ctx
.
getFieldValue
(
'orderModel'
)
<
OrderModalType
.
PURCHASE_ENQUIRY_CONTRACT_ORDER
)
{
// 新增下 需要支付信息生成支付次数 // @采购合同下单无需支付信息
fetchOrderApi
.
getPayInfoList
({
productId
:
(
orderModel
===
OrderModalType
[
"HAND_ORDER"
]
||
orderModel
===
OrderModalType
[
"CHANNEL_DIRECT_MINING_ORDER"
]
||
orderModel
===
OrderModalType
[
"CHANNEL_SPOT_MANUAL_ORDER"
])
?
productItem
.
id
:
productItem
.
productId
,
memberId
:
productItem
?.
memberId
||
ctx
.
getFieldValue
(
'supplyMembersId'
),
...
...
@@ -156,7 +157,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
if
(
auth
.
memberRoleType
===
2
)
{
// 采购商
// 企业+个人
// if ((auth.memberType === 1 || auth.memberType === 2) && (assign.value > 9 && assign.value !== 24)) {
if
((
auth
.
memberType
===
1
||
auth
.
memberType
===
2
)
&&
assign
.
value
>
9
)
{
if
((
auth
.
memberType
===
1
||
auth
.
memberType
===
2
)
&&
(
assign
.
value
>
9
&&
assign
.
value
<
30
)
)
{
assign
.
disabled
=
true
}
// 渠道(企业+个人)
...
...
@@ -187,7 +188,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
// 商城跳转过来的数据
const
initValue
=
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
spam_id
))
// 从商城跳转,
需回显数据
// 从商城跳转,需回显数据
if
(
initValue
)
{
const
fn
=
async
(
initValue
)
=>
{
const
productInfo
=
initValue
.
orderList
[
0
].
orderList
...
...
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
View file @
3d71db09
This diff is collapsed.
Click to expand it.
src/pages/transaction/purchaseOrder/orderCollect/model/useMaterialTable.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
useRef
,
useState
}
from
'react'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
{
Button
,
message
}
from
'antd'
;
import
{
PriceComp
,
materialInfoColumns
}
from
'../constant'
;
import
MaterialTableCell
,
{
MaterialEditableRow
}
from
'../components/materialTableCell'
;
import
{
useModalTable
}
from
'./useModalTable'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
OrderModalType
}
from
'@/constants'
;
import
{
history
}
from
"umi"
;
const
{
pageStatus
}
=
usePageStatus
()
let
orderModel
=
null
;
// 对象按key排序(运用于商城传过来的阶梯价格排序)
export
const
sortByKey
=
(
params
)
=>
{
let
keys
=
Object
.
keys
(
params
).
sort
((
x
,
y
)
=>
parseInt
(
x
)
-
parseInt
(
y
));
let
newParams
=
{};
keys
.
forEach
((
key
)
=>
{
newParams
[
key
]
=
params
[
key
];
});
return
newParams
;
}
export
const
getUnitPriceTotal
=
(
record
)
=>
{
const
purchaseCount
=
Number
(
record
[
'purchaseCount'
])
||
0
record
.
unitPrice
=
pageStatus
===
PageStatus
.
EDIT
?
record
.
price
:
record
.
unitPrice
||
record
.
price
||
0
if
(
typeof
record
.
unitPrice
===
'number'
)
{
return
Number
((
record
.
unitPrice
*
purchaseCount
).
toFixed
(
2
))
}
if
(
record
.
unitPrice
)
{
record
.
unitPrice
=
sortByKey
(
record
.
unitPrice
)
}
// fix 当没有传递unitPrice字段时 但有price字段时 补全unitPrice字段
if
(
record
.
price
&&
JSON
.
stringify
(
record
.
unitPrice
)
===
"{}"
)
{
record
.
unitPrice
=
{
'0-0'
:
record
.
price
}
}
}
/**
* @param ctx schemaAction
*/
export
const
useMaterialTable
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
const
materialRef
=
useRef
<
any
>
({})
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
useModalTable
({
type
:
'checkbox'
})
orderModel
=
ctx
.
getFieldValue
(
'orderModel'
)
const
handleDelete
=
(
record
)
=>
{
const
newData
=
[...
ctx
.
getFieldValue
(
'orderProductRequests'
)]
// 删除formvalue
const
colIndex
=
newData
.
findIndex
(
v
=>
v
.
id
===
record
.
id
)
newData
.
splice
(
colIndex
,
1
)
// 删除选中的项
rowSelectionCtl
.
setSelectRow
(
newData
)
rowSelectionCtl
.
setSelectedRowKeys
(
newData
.
map
(
v
=>
v
.
id
))
ctx
.
setFieldValue
(
'orderProductRequests'
,
newData
)
}
const
[
materialColumns
,
setMaterialColumns
]
=
useState
(()
=>
{
if
(
pageStatus
===
PageStatus
.
ADD
)
{
// 渲染操作
materialInfoColumns
[
materialInfoColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelete
(
record
)
}
>
删除
</
Button
>
// 渲染单价
materialInfoColumns
[
5
].
render
=
(
t
,
r
)
=>
{
if
(
orderModel
===
OrderModalType
[
"HAND_ORDER"
])
{
return
<
PriceComp
priceSection=
{
r
.
unitPrice
}
/>
}
else
{
return
r
.
price
?
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
r
.
price
}
</
span
>
:
<
PriceComp
priceSection=
{
r
.
unitPrice
}
/>
}
}
// 渲染商品ID
materialInfoColumns
[
0
].
render
=
(
t
,
r
)
=>
{
if
(
orderModel
===
OrderModalType
[
"HAND_ORDER"
])
{
return
r
.
id
}
else
{
return
r
.
id
?
r
.
id
:
r
.
productId
}
}
}
else
{
// 渲染单价
materialInfoColumns
[
5
].
render
=
(
t
,
r
)
=>
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
r
.
price
}
</
span
>
// 渲染商品ID
materialInfoColumns
[
0
].
render
=
(
t
,
r
)
=>
r
.
productId
}
return
materialInfoColumns
})
const
handleShowMaterial
=
()
=>
{
const
supplyMembersId
=
ctx
.
getFieldValue
(
'supplyMembersId'
)
if
(
supplyMembersId
)
{
materialRef
.
current
.
setVisible
(
true
)
}
else
{
message
.
error
(
'请先选择采购询价合同'
)
}
}
const
materialAddButton
=
<
Button
onClick=
{
handleShowMaterial
}
block
type=
'default'
style=
{
{
margin
:
'24px auto'
}
}
>
选择采购物料
</
Button
>
const
materialComponents
=
{
body
:
{
row
:
MaterialEditableRow
,
cell
:
MaterialTableCell
}
}
const
handleSave
=
row
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
newData
=
[...
ctx
.
getFieldValue
(
'orderProductRequests'
)];
const
index
=
newData
.
findIndex
(
item
=>
row
.
id
===
item
.
id
);
const
item
=
newData
[
index
];
row
[
'money'
]
=
getUnitPriceTotal
(
row
)
// 通过下单模式判断 是否是手工或者渠道手工下单
let
addModel
=
ctx
.
getFieldValue
(
"orderModel"
)
row
[
'productId'
]
=
(
addModel
===
OrderModalType
[
"HAND_ORDER"
]
||
addModel
===
OrderModalType
[
"CHANNEL_DIRECT_MINING_ORDER"
]
||
addModel
===
OrderModalType
[
"CHANNEL_SPOT_MANUAL_ORDER"
]
)
?
row
.
id
:
row
.
productId
newData
.
splice
(
index
,
1
,
{
...
item
,
...
row
,
});
ctx
.
setFieldValue
(
'orderProductRequests'
,
newData
)
resolve
({
item
,
newData
})
})
};
const
materialMergeColumns
=
materialColumns
.
map
(
col
=>
{
if
(
!
col
.
editable
)
{
return
col
;
}
return
{
...
col
,
onCell
:
record
=>
({
record
,
editable
:
ctx
.
getFormState
().
editable
===
false
?
false
:
col
.
editable
,
dataIndex
:
col
.
dataIndex
,
title
:
col
.
title
,
formItem
:
col
.
formItem
,
formItemProps
:
col
.
formItemProps
,
handleSave
}),
};
})
return
{
materialRef
,
materialAddButton
,
materialColumns
:
materialMergeColumns
,
materialComponents
,
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
}
src/pages/transaction/purchaseOrder/orderCollect/schema/index.ts
View file @
3d71db09
...
...
@@ -2,7 +2,17 @@ import { ISchema } from '@formily/antd';
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
import
moment
from
'moment'
import
{
DELIVERY_TYPE_ENUM
}
from
'@/constants'
;
import
{
DELIVERY_TYPE_ENUM
,
SHOP_TYPES
}
from
'@/constants'
;
// 将获取的商城转化为可用类型
const
getShopTypeMap
=
(()
=>
{
return
GlobalConfig
.
web
.
shopInfo
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
id
,
type
:
item
.
type
,
environment
:
item
.
environment
,
}))
})()
/**
* 除了订单必填字段, 默认
...
...
@@ -92,11 +102,11 @@ const basicInfo: ISchema = {
{
type
:
"value:schema"
,
"target"
:
"quotationNo"
,
condition
:
`{{!!$value && orderCombination.showQuotationNoOrderBtn.includes($value)}}`
,
condition
:
`{{!!$value && orderCombination.showQuotationNoOrderBtn.includes($value)
|| orderCombination.showPurchaseContract.includes($value)
}}`
,
schema
:
{
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{order
NoPrice
}}"
addonAfter
:
"{{order
Combination.showQuotationNoOrderBtn.includes($value) ? orderNoPrice : orderContract
}}"
}
},
otherwise
:
{
...
...
@@ -128,6 +138,13 @@ const basicInfo: ISchema = {
},
],
},
shopId
:
{
type
:
'string'
,
enum
:
getShopTypeMap
,
title
:
'适应商城'
,
required
:
true
,
visible
:
false
,
},
orderThe
:
{
type
:
'string'
,
title
:
'订单摘要'
,
...
...
@@ -214,13 +231,18 @@ const basicInfo: ISchema = {
title
:
'外部状态'
,
visible
:
false
},
contractId
:
{
type
:
'number'
,
title
:
'采购合同ID'
,
visible
:
false
},
}
},
}
}
// 订单商品
const
orderProduct
:
ISchema
=
{
export
const
orderProduct
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
...
...
@@ -248,8 +270,39 @@ const orderProduct: ISchema = {
}
}
}
// 合同下单 订单物料
export
const
orderMaterial
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'订单物料'
},
properties
:
{
orderProductRequests
:
{
type
:
'array'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'id'
,
columns
:
"{{materialColumns}}"
,
components
:
"{{materialComponents}}"
,
},
},
// 仅合同下单时备用参数数据
ordeProducts
:
{
type
:
'array'
,
title
:
'合同下单记录'
,
visible
:
false
},
NO_SUBMIT_SPY
:
{
type
:
'object'
,
"x-component"
:
"moneyTotalBox"
}
}
}
// 支付信息
const
payInfo
:
ISchema
=
{
export
const
payInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
...
...
@@ -274,6 +327,8 @@ const payInfo: ISchema = {
}
}
}
// 交付信息
const
submitInfo
:
ISchema
=
{
type
:
'object'
,
...
...
@@ -407,12 +462,12 @@ const ortherInfo: ISchema = {
}
]
},
// 仅进货单下单传入接口使用
shopId
:
{
type
:
'number'
,
title
:
'店铺ID'
,
visible
:
false
},
//
//
仅进货单下单传入接口使用
//
shopId: {
//
type: 'number',
//
title: '店铺ID',
//
visible: false
//
},
// 仅简单流程使用合同情况下使用
processEnum
:
{
type
:
'number'
,
...
...
src/pages/transaction/purchaseRules/addRule.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
useState
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Card
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
SaveOutlined
,
}
from
'@ant-design/icons'
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
'./index.less'
import
{
ruleDetailSchema
}
from
'./schema'
import
{
createFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
findItemAndDelete
,
omit
}
from
'@/utils'
import
{
PublicApi
}
from
'@/services/api'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
RuleSetting
from
'./components/RuleSetting'
const
addSchemaAction
=
createFormActions
()
const
AddRule
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
[
isDisabled
,
setIsDisabled
]
=
useState
<
boolean
>
(
false
)
const
{
id
,
preview
,
pageStatus
}
=
usePageStatus
()
// 整体表单提交
const
formSubmit
=
async
(
values
)
=>
{
setIsDisabled
(
true
)
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
params
.
processEnum
=
params
.
processEnumId
addSchemaAction
.
getFieldState
(
'processEnumId'
,
state
=>
{
const
process
=
state
.
dataSource
.
filter
(
item
=>
item
.
id
===
params
.
processEnumId
)[
0
]
params
.
type
=
process
.
type
})
let
res
:
any
=
{}
if
(
pageStatus
===
PageStatus
.
EDIT
){
res
=
await
PublicApi
.
postManageRuleUpdate
(
params
)
}
else
if
(
pageStatus
===
PageStatus
.
ADD
){
res
=
await
PublicApi
.
postManageRuleAdd
(
params
)
}
setIsDisabled
(
false
)
history
.
goBack
(
-
1
)
}
return
(
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
title=
{
pageStatus
===
PageStatus
.
PREVIEW
?
'查看采购流程规则'
:
(
pageStatus
===
PageStatus
.
EDIT
?
'编辑采购流程规则'
:
'新增采购流程规则'
)
}
className=
"addRule"
extra=
{
[
<
Button
key=
"1"
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
||
isDisabled
}
>
保存
</
Button
>,
]
}
>
<
Card
className=
''
>
<
RuleSetting
addSchemaAction=
{
addSchemaAction
}
schema=
{
ruleDetailSchema
}
formSubmit=
{
formSubmit
}
/>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
AddRule
src/pages/transaction/purchaseRules/components/RuleSetting.tsx
0 → 100644
View file @
3d71db09
This diff is collapsed.
Click to expand it.
src/pages/transaction/purchaseRules/components/selectProcesss/index.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
import
styled
from
'styled-components'
import
{
ISchemaFormProps
,
ISchemaFieldProps
,
ISchemaFieldComponentProps
,
createFormActions
,
useFieldState
}
from
'@formily/antd'
import
{
Button
,
Space
,
Row
,
Col
,
Tag
}
from
'antd'
import
{
PlusOutlined
,
DeleteColumnOutlined
,
EditOutlined
,
DeleteOutlined
,
CaretUpOutlined
,
CaretDownOutlined
,
EyeOutlined
}
from
'@ant-design/icons'
import
cx
from
'classnames'
import
{
PublicApi
}
from
'@/services/api'
const
SelectStyles
=
styled
((
props
)
=>
<
div
className=
'select-list'
{
...
props
}
></
div
>)
`
.select_style_border {
border: 1px solid #EEF0F3;
margin-top: 20px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 14px;
cursor: pointer;
line-height: 28px;
position:relative;
}
.select_style_border.active {
border: 1px solid #00B382;
}
.select_style_border.active::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid #00B37A;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
`
enum
ProcessTagColor
{
'red'
,
'orange'
,
'purple'
,
'blue'
,
'green'
}
enum
ProcessTagType
{
'订单交易流程'
,
'售后换货流程'
,
'售后退货流程'
,
'售后维修流程'
,
'加工生产流程'
}
const
SelectProcesss
=
(
props
:
ISchemaFieldComponentProps
)
=>
{
const
[
formInitValue
,
setFormInitValue
]
=
useState
<
any
>
(
null
)
const
[
state
,
setFieldState
]
=
useFieldState
({
dataSource
:
[],
showMore
:
false
})
const
{
dataSource
,
showMore
}
=
state
const
{
value
,
mutators
,
editable
}
=
props
useEffect
(()
=>
{
PublicApi
.
getOrderTradingRulesTransactionProcessList
().
then
(
res
=>
{
setFieldState
({
dataSource
:
res
.
data
,
showMore
})
})
},
[])
const
showDataSource
=
showMore
?
dataSource
:
[...
dataSource
].
splice
(
0
,
3
)
const
handleCheck
=
(
id
)
=>
{
if
(
editable
)
{
mutators
.
change
(
id
)
}
}
const
toogleMore
=
()
=>
{
setFieldState
({
dataSource
,
showMore
:
!
showMore
})
}
const
renderProcessType
=
(
v
:
any
)
=>
{
return
<
Tag
color=
{
ProcessTagColor
[
v
.
type
-
1
]
}
>
{
ProcessTagType
[
v
.
type
-
1
]
}
</
Tag
>
}
return
(
<
div
style=
{
{
width
:
'100%'
}
}
>
<
SelectStyles
>
{
showDataSource
.
map
(
v
=>
<
div
key=
{
v
.
id
}
onClick=
{
()
=>
handleCheck
(
v
.
id
)
}
className=
{
cx
(
'select_style_border'
,
value
===
v
.
id
?
'active'
:
''
)
}
>
<
div
>
<
Row
style=
{
{
color
:
'#303133'
}
}
>
<
Col
>
{
v
.
name
}
</
Col
>
<
Col
style=
{
{
marginLeft
:
6
}
}
>
{
renderProcessType
(
v
)
}
</
Col
>
</
Row
>
<
div
style=
{
{
color
:
'#909399'
}
}
>
{
v
.
explain
}
</
div
>
</
div
>
</
div
>)
}
</
SelectStyles
>
{
dataSource
.
length
>
3
&&
<
div
onClick=
{
toogleMore
}
style=
{
{
textAlign
:
'center'
,
cursor
:
'pointer'
}
}
>
显示更多
{
showMore
?
<
CaretDownOutlined
/>
:
<
CaretUpOutlined
/>
}
</
div
>
}
</
div
>
)
}
SelectProcesss
.
defaultProps
=
{}
SelectProcesss
.
isFieldComponent
=
true
;
export
default
SelectProcesss
src/pages/transaction/purchaseRules/effects/index.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
useEffect
}
from
'react'
import
{
ISchemaFormActions
,
FormEffectHooks
,
IFormActions
}
from
'@formily/antd'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
const
{
onFieldValueChange$
}
=
FormEffectHooks
export
const
createAddContractTemplateEffect
=
(
context
:
ISchemaFormActions
)
=>
{
const
fetchListContractTemplateAll
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getContractSelectListContractTemplate
()
context
.
setFieldState
(
'electronicContractId'
,
state
=>
{
state
.
contractTemplateLists
=
data
})
return
data
.
map
(
v
=>
({
value
:
v
.
id
,
label
:
v
.
name
}))
}
useAsyncSelect
(
'electronicContractId'
,
fetchListContractTemplateAll
)
}
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
useEffect
(()
=>
{
context
.
setFieldValue
(
'isElectronicContract'
,
initValue
?.
isElectronicContract
?
true
:
false
)
context
.
setFieldValue
(
'isTacitlyApprove'
,
initValue
?.
isTacitlyApprove
)
},
[
initValue
])
}
src/pages/transaction/purchaseRules/index.less
0 → 100644
View file @
3d71db09
.addRule {
.ant-input-group-addon {
padding: 0;
border: none;
}
.connectBtn {
width: 80px;
height: 32px;
line-height: 32px;
background: #909399;
color: #fff;
text-align: center;
cursor: pointer;
}
}
src/pages/transaction/purchaseRules/index.tsx
0 → 100644
View file @
3d71db09
import
React
,
{
ReactNode
,
useRef
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Popconfirm
,
Card
,
Space
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
PlayCircleOutlined
,
PauseCircleOutlined
,
}
from
'@ant-design/icons'
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
moment
from
'moment'
import
EyePreview
from
'@/components/EyePreview'
;
import
{
PublicApi
}
from
'@/services/api'
import
NiceForm
from
'@/components/NiceForm'
import
{
createFormActions
}
from
'@formily/antd'
const
formActions
=
createFormActions
();
const
PurchaseRules
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
fetchData
=
(
params
:
any
)
=>
{
if
(
!
params
?.
name
)
delete
params
.
name
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getManageRuleList
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
})
}
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'流程规则ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'流程规则名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/tranactionAbility/purchaseRules/detail?id=${record.id}&preview=1`
}
>
{
text
}
</
EyePreview
>
},
{
title
:
'操作时间'
,
dataIndex
:
'updateTime'
,
key
:
'updateTime'
,
render
:
(
text
:
any
,
record
:
any
)
=>
text
&&
moment
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
title
:
'状态'
,
dataIndex
:
'state'
,
key
:
'state'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
component
=
(
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
confirm
(
record
)
}
onCancel=
{
cancel
}
okText=
"是"
cancelText=
"否"
>
<
Button
type=
"link"
style=
{
record
.
state
?
{
color
:
'#00B37A'
}
:
{
color
:
'red'
}
}
>
{
record
.
state
?
<>
有效
<
PlayCircleOutlined
/></>
:
<>
无效
<
PauseCircleOutlined
/></>
}
</
Button
>
</
Popconfirm
>
)
return
component
}
},
{
title
:
'操作'
,
dataIndex
:
'option'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
{
(
record
.
state
===
0
)
?
<>
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
handelDelete
(
record
)
}
onCancel=
{
cancel
}
okText=
"是"
cancelText=
"否"
>
<
Button
type=
'link'
>
删除
</
Button
>
</
Popconfirm
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/tranactionAbility/purchaseRules/add?id=${record.id}`
)
}
>
修改
</
Button
>
</>
:
''
}
</>
)
}
}
];
const
confirm
=
(
record
:
any
)
=>
{
PublicApi
.
postManageRuleStartOrStop
({
id
:
record
.
id
,
state
:
record
.
state
?
0
:
1
}).
then
(
res
=>
{
ref
.
current
.
reload
()
})
}
const
cancel
=
()
=>
{
console
.
log
(
'cancel'
)
}
const
handelDelete
=
(
record
:
any
)
=>
{
PublicApi
.
postManageRuleDelete
({
id
:
record
.
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
ref
.
current
.
reload
()
})
}
const
Actions
=
(
<
Space
>
<
Button
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
history
.
push
(
'/memberCenter/tranactionAbility/purchaseRules/add'
)
}
>
新建
</
Button
>
</
Space
>
);
return
(
<
PageHeaderWrapper
>
<
Card
>
<
StandardTable
tableProps=
{
{
rowKey
:
'id'
,
}
}
columns=
{
columns
}
currentRef=
{
ref
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
controlRender=
{
<
NiceForm
actions=
{
formActions
}
expressionScope=
{
{
Actions
,
}
}
effects=
{
(
$
,
actions
)
=>
{
}
}
schema=
{
{
type
:
'object'
,
properties
:
{
searchWrap
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
grid
:
true
,
},
properties
:
{
actions
:
{
type
:
'object'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{Actions}}'
,
},
},
name
:
{
type
:
'string'
,
'x-component'
:
'Search'
,
'x-component-props'
:
{
placeholder
:
'规则名称'
,
advanced
:
false
,
// tip: '输入 单据名称 进行搜索',
},
},
},
},
},
}
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
/>
}
/>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
PurchaseRules
src/pages/transaction/purchaseRules/schema/index.tsx
0 → 100644
View file @
3d71db09
import
React
from
'react'
import
{
ISchema
}
from
'@formily/antd'
;
import
{
padRequiredMessage
}
from
'@/utils'
;
// 新增规则
export
const
ruleDetailSchema
:
ISchema
=
padRequiredMessage
({
type
:
'object'
,
properties
:
{
REPOSIT_TABS
:
{
type
:
'object'
,
"x-component"
:
"tab"
,
"x-component-props"
:
{
type
:
'card'
,
},
properties
:
{
"tab-1"
:
{
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"基本信息"
},
"properties"
:
{
MEGA_LAYOUT1
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
wrapperCol
:
8
,
labelAlign
:
'left'
,
style
:
{
height
:
'400px'
}
},
properties
:
{
"name"
:
{
type
:
'string'
,
title
:
'规则名称'
,
"x-component-props"
:
{
placeholder
:
'请输入规则名称'
},
"x-rules"
:
[
{
required
:
true
,
},
{
limitByte
:
true
,
maxByte
:
48
}
]
},
"processEnumId"
:
{
type
:
'string'
,
title
:
'流程选择'
,
"x-component"
:
'SelectProcesss'
,
"x-mega-props"
:
{
style
:
{
full
:
true
}
},
"x-component-props"
:
{
dataSource
:
[]
},
"x-rules"
:
[
{
required
:
true
,
message
:
'请选择流程配置'
}
],
},
"type"
:
{
type
:
'number'
,
title
:
'流程类型'
,
visible
:
false
,
},
}
}
}
},
"tab-2"
:
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
"tab"
:
"适用合同"
},
properties
:
{
MEGA_LAYOUT3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
},
properties
:
{
"isApplyContract"
:
{
"type"
:
"radio"
,
enum
:
[
{
label
:
'所有合同(默认)'
,
value
:
1
},
{
label
:
'指定合同'
,
value
:
0
},
],
"title"
:
"适用合同"
,
default
:
1
,
required
:
true
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'ruleContracts'
,
"condition"
:
"{{!$value}}"
}
]
},
"ruleContracts"
:
{
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'id'
,
columns
:
"{{tableColumns}}"
,
prefix
:
"{{tableAddButton}}"
,
}
}
}
}
}
}
}
}
}
})
src/services/api.ts
View file @
3d71db09
...
...
@@ -16,6 +16,8 @@ import * as ContractApi from './ContractApi';
import
*
as
PurchaseV2Api
from
'./PurchaseV2Api'
;
import
*
as
TransactionV2Api
from
'./TransactionV2Api'
;
import
*
as
ContractV2Api
from
'./ContractV2Api'
;
import
*
as
OrderV2Api
from
'./OrderV2Api'
;
import
*
as
PlatformApi
from
'./PlatformApi'
;
/**
* 可在这里写入自定义的接口
...
...
@@ -44,4 +46,6 @@ export const PublicApi = {
...
PurchaseV2Api
,
...
TransactionV2Api
,
...
ContractV2Api
,
...
OrderV2Api
,
...
PlatformApi
,
}
ytt.config.ts
View file @
3d71db09
const
tokenList
=
[
{
name
:
'Pass'
,
token
:
'b063a0a29fb1a570d9f00eaabbdd8ccfe8e6e10e24739441990cc1098e79b601'
,
categoryIds
:
[
0
],
},
// 业务中台管理平台
{
name
:
'Warehouse'
,
token
:
'7c8f235d95f6224ceb97c4d832b09658f9a75fb8721a95699b230af0733d7fa4'
,
categoryIds
:
[
0
],
},
// 仓库服务
{
name
:
'Logistics'
,
token
:
'
8d14d945507d1f8cd89afe139ca6d111bbad25f702fafe0aec59d3c9cd2e0ffe
'
,
categoryIds
:
[
0
],
},
// 物流服务
{
name
:
'Logistics'
,
token
:
'
592c2a238eeb0e608ecaa4ec9f09aa2bf7da02d764aa3fb1dfd493cae7a9a036
'
,
categoryIds
:
[
0
],
},
// 物流服务
{
name
:
'Member'
,
token
:
'c0e920f071595a73ba234b6fa6cfe42192d3d740d59f030caa2c7f0f08777d78'
,
categoryIds
:
[
0
],
},
// 商户会员管理服务
{
name
:
'Product'
,
token
:
'dbfeae0baf614a6dd8f1de2b1403444cdfa9c052a3757da6a0d6d7d52fb26178'
,
categoryIds
:
[
0
],
},
// 商品服务
{
name
:
'Template'
,
token
:
'7ec923520215c7e2f771867cb4d29cafbf823daf0fb2d3d9fa70b57a523c8bfb'
,
categoryIds
:
[
0
],
},
// 店铺模板服务
...
...
@@ -17,8 +17,9 @@ const tokenList = [
{
name
:
'Purchase'
,
token
:
'a09e2b66e00079df9881fc660eb17db0265e33362c13f03f2003ba81d26f49d8'
,
categoryIds
:
[
0
],
},
// 采购服务
{
name
:
'PurchaseV2'
,
token
:
'84c81ef877863ad4e2c0ebb2c3b3e80f9539420f2fc0828ef33f5159e8423b2c'
,
categoryIds
:
[
0
]
},
// 采购服务V2
{
name
:
'TransactionV2'
,
token
:
'3ad04435494d01c359b9f07948338e019133a3e6c0fccdbe1bc3adc19cf1e0b1'
,
categoryIds
:
[
0
]
},
// 交易服务V2
{
name
:
'ContractV2'
,
token
:
'b1b7ee2d99434fe0f4d89bfa5c6a05e917c297219653a045b8b2ee5415b37e43'
,
categoryIds
:
[
0
]
},
// 合同能力V2
{
name
:
'ContractV2'
,
token
:
'bbf1f327cfe7c59d1e7fd9c5d25119829dd79d238b1f1c79ed97331e220721a4'
,
categoryIds
:
[
0
]
},
// 合同能力V2
{
name
:
'OrderV2'
,
token
:
'033f83bd5f519506f65f46d1513b1f8028a1dc1b5238d22edd0a2feb53cd3a19'
,
categoryIds
:
[
0
],
},
//订单服务V2
{
name
:
'Platform'
,
token
:
'cadc3b13452c3ec67b5ef0c57063f12142e857a9eaa64669e80165adf42f5861'
,
categoryIds
:
[
0
]
}
// 平台后台v2
]
const
getConfigMap
=
(
tokens
)
=>
tokens
.
map
(
v
=>
({
...
...
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