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
黄庭坚
jinfa-platform
Commits
0b255b50
Commit
0b255b50
authored
Dec 03, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加代客维修申请
parent
eb944260
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1006 additions
and
12 deletions
+1006
-12
repairManageRoute.ts
config/routes/afterServiceRoute/repairManageRoute.ts
+7
-0
menu.ts
src/locales/zh-CN/menu.ts
+1
-0
index.tsx
...pplication/repairPrSubmit/components/RepairForm/index.tsx
+2
-10
index.ts
...tion/repairPrSubmit/components/RepairForm/schema/index.ts
+5
-2
index.tsx
...erService/repairManage/repairValetApply/effects/index.tsx
+30
-0
useBusinessEffects.ts
...pairManage/repairValetApply/effects/useBusinessEffects.ts
+59
-0
index.less
...ges/afterService/repairManage/repairValetApply/index.less
+0
-0
index.tsx
...ages/afterService/repairManage/repairValetApply/index.tsx
+524
-0
schema.ts
...ages/afterService/repairManage/repairValetApply/schema.ts
+378
-0
No files found.
config/routes/afterServiceRoute/repairManageRoute.ts
View file @
0b255b50
...
...
@@ -154,6 +154,13 @@ const route: RouterChild = {
hideInMenu
:
true
,
noMargin
:
true
,
},
// 代客维修申请
{
path
:
'/memberCenter/afterService/repairManage/repairValetApply/index'
,
name
:
'repairValetApply'
,
component
:
'@/pages/afterService/repairManage/repairValetApply/index'
,
noMargin
:
true
,
},
]
}
...
...
src/locales/zh-CN/menu.ts
View file @
0b255b50
...
...
@@ -662,6 +662,7 @@ export default {
'menu.afterService.repairManage.repairPrConfirm'
:
'待确认维修申请单'
,
'menu.afterService.repairManage.repairPrConfirmDetail'
:
'查看维修申请单'
,
'menu.afterService.repairManage.verifyRepairPrConfirm'
:
'审核维修申请单'
,
'menu.afterService.repairManage.repairValetApply'
:
'代客维修申请'
,
'menu.afterService.repairManage.orderPreview'
:
'查看订单'
,
// 结算能力
...
...
src/pages/afterService/repairApplication/repairPrSubmit/components/RepairForm/index.tsx
View file @
0b255b50
...
...
@@ -12,18 +12,11 @@ import { createFormActions, FormEffectHooks } from '@formily/antd';
import
{
getAsRepairGoodsGetDetailByConsumer
,
getAsRepairGoodsPageRepairGoods
,
GetAsRepairGoodsPageRepairGoodsResponseDetail
,
postAsRepairGoodsSave
}
from
'@/services/AfterServiceV2Api'
;
import
{
getOrderBuyerDetail
,
getOrderCommonAfterSalePage
}
from
'@/services/OrderNewV2Api'
;
import
{
normalizeFiledata
,
FileData
,
isJSONStr
}
from
'@/utils'
;
import
{
ORDER_TYPE_INQUIRY_CONTRACT
,
ORDER_TYPE_BIDDING_CONTRACT
,
ORDER_TYPE_TENDER_CONTRACT
,
ORDER_TYPE2
,
}
from
'@/constants/order'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
StatusTag
from
'@/components/StatusTag'
;
import
GoodsDrawer
from
'../../../../components/GoodsDrawer'
;
import
{
OrderListRes
}
from
'../../../../components/GoodsDrawer/interface'
;
import
AddressFormItem
from
'../../../../components/AddressFormItem'
;
import
{
addSchema
}
from
'./schema'
;
import
{
createEffects
}
from
'./effects'
;
import
{
...
...
@@ -630,9 +623,8 @@ const RepairForm: React.FC<BillsFormProps> = ({
beforeUpload
,
}
}
components=
{
{
ArrayTable
,
AddressFormItem
,
OrderNo
,
ArrayTable
,
OrderNo
,
}
}
editable=
{
isEdit
||
!
id
}
effects=
{
(
$
,
actions
)
=>
{
...
...
src/pages/afterService/repairApplication/repairPrSubmit/components/RepairForm/schema/index.ts
View file @
0b255b50
...
...
@@ -434,15 +434,18 @@ export const addSchema = (orderType: number): ISchema => {
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
labelCol
:
4
,
wrapperCol
:
12
,
labelAlign
:
'left'
,
},
properties
:
{
repairAddress
:
{
title
:
'维修地址'
,
type
:
'string'
,
'x-component'
:
'
AddressFormItem
'
,
'x-component'
:
'
CustomAddressSelect
'
,
'x-component-props'
:
{
dataSource
:
[],
isDefaultAddress
:
true
,
addressType
:
1
,
echo
:
true
,
},
'x-rules'
:
[
{
...
...
src/pages/afterService/repairManage/repairValetApply/effects/index.tsx
0 → 100644
View file @
0b255b50
/*
* @Author: XieZhiXiong
* @Date: 2021-12-03 09:56:25
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-03 09:56:25
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
import
{
getLogisticsSelectListReceiverAddress
}
from
'@/services/LogisticsV2Api'
;
const
{
onFormMount$
}
=
FormEffectHooks
;
export
const
createEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
}
=
actions
;
useBusinessEffects
(
context
,
actions
);
onFormMount$
().
subscribe
(()
=>
{
// 获取收件地址
getLogisticsSelectListReceiverAddress
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setFieldState
(
'repairAddress'
,
state
=>
{
state
.
props
[
'x-component-props'
].
dataSource
=
res
.
data
;
});
}
});
});
};
\ No newline at end of file
src/pages/afterService/repairManage/repairValetApply/effects/useBusinessEffects.ts
0 → 100644
View file @
0b255b50
/*
* @Author: XieZhiXiong
* @Date: 2021-12-03 09:57:51
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-03 10:31:06
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
const
{
onFieldInputChange$
,
onFieldValueChange$
,
}
=
FormEffectHooks
;
export
const
useBusinessEffects
=
(
context
,
actions
)
=>
{
const
{
getFieldValue
,
setFieldValue
,
getFieldState
,
setFieldState
,
}
=
actions
;
const
linkage
=
useLinkageUtils
();
// 校验维修数量
onFieldInputChange$
(
'repairGoodsList.*.repairCount'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
// 已维修数量
const
repairedCountValue
=
getFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`repairGoodsList.
${
$1
}
.extraData`
}),
state
=>
state
.
value
.
remaining
,
);
// 不需要做数量校验
// setFieldState(
// FormPath.transform(name, /\d/, $1 => {
// return `repairGoodsList.${$1}.repairCount`
// }),
// state => {
// if (+value > repairedCountValue) {
// state.errors = '填写值已超过最大可维修数量,请重新填写';
// } else {
// state.errors = '';
// }
// }
// );
});
// 供应会员、订单类型 联动 单据明细
onFieldInputChange$
(
'*(supplierMember,orderType)'
).
subscribe
(
fieldState
=>
{
const
replaceGoodsListValue
=
getFieldValue
(
'repairGoodsList'
);
if
(
replaceGoodsListValue
&&
replaceGoodsListValue
.
length
)
{
setFieldValue
(
'repairGoodsList'
,
[]);
}
});
}
\ No newline at end of file
src/pages/afterService/repairManage/repairValetApply/index.less
0 → 100644
View file @
0b255b50
src/pages/afterService/repairManage/repairValetApply/index.tsx
0 → 100644
View file @
0b255b50
/*
* @Author: XieZhiXiong
* @Date: 2021-12-03 09:54:46
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-03 10:41:53
* @Description: 代客维修申请
*/
import
React
,
{
useState
,
useMemo
}
from
'react'
;
import
{
Button
,
Card
,
Spin
,
Badge
,
message
,
Upload
}
from
'antd'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
DeleteOutlined
}
from
'@ant-design/icons'
;
import
{
ArrayTable
}
from
'@formily/antd-components'
;
import
{
history
,
Prompt
}
from
'umi'
;
import
moment
from
'moment'
;
import
{
debounce
,
findLastIndex
}
from
'lodash'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
SaveOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
GetAsRepairGoodsPageRepairGoodsResponseDetail
,
postAsRepairGoodsAgentSave
}
from
'@/services/AfterServiceV2Api'
;
import
{
getOrderCommonAgentAfterSalePage
}
from
'@/services/OrderNewV2Api'
;
import
{
getMemberManageOrderAgentMembers
,
GetMemberManageOrderAgentMembersResponse
}
from
'@/services/MemberV2Api'
;
import
{
FileData
}
from
'@/utils'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
StatusTag
from
'@/components/StatusTag'
;
import
GoodsDrawer
from
'../../components/GoodsDrawer'
;
import
{
OrderListRes
}
from
'../../components/GoodsDrawer/interface'
;
import
{
addSchema
}
from
'./schema'
;
import
{
createEffects
}
from
'./effects'
;
import
{
REPAIR_OUTER_STATUS_TAG_MAP
,
REPAIR_INNER_STATUS_BADGE_MAP
,
}
from
'../../constants'
;
import
{
isMaterialOrder
}
from
'../../utils'
;
const
addSchemaAction
=
createFormActions
();
const
{
onFormInputChange$
,
onFieldInputChange$
,
onFormInit$
,
}
=
FormEffectHooks
;
interface
DetailInfo
{
applyTime
:
string
;
faultFileList
?:
FileData
[];
repairAddress
?:
{
[
key
:
string
]:
any
}[];
supplierMember
?:
{},
outerStatus
?:
number
,
outerStatusName
?:
string
,
innerStatus
?:
number
,
innerStatusName
?:
string
,
/**
* 订单编号
*/
orderNo
?:
string
,
/**
* 订单类型
*/
orderType
?:
number
,
}
interface
BillsFormProps
{}
interface
OrderNoProps
{
value
:
any
,
}
const
OrderNo
=
(
props
:
OrderNoProps
)
=>
{
const
{
value
}
=
props
;
return
(
<
a
href=
{
`/memberCenter/afterService/repairApplication/repairPrSubmit/orderDetail?orderNo=${value}`
}
target=
"_blank"
>
{
value
}
</
a
>
)
};
OrderNo
.
isFieldComponent
=
true
;
const
RepairValetApply
:
React
.
FC
<
BillsFormProps
>
=
()
=>
{
const
[
detailInfo
]
=
useState
<
DetailInfo
>
({
applyTime
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
});
const
[
repairGoodsList
]
=
useState
<
GetAsRepairGoodsPageRepairGoodsResponseDetail
[]
>
([]);
const
[
unsaved
,
setUnsaved
]
=
useState
(
false
);
const
[
goodsValue
,
setGoodsValue
]
=
useState
([]);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
[
visibleDrawer
,
setVisibleDrawer
]
=
useState
(
false
);
const
[
orderTypeValue
,
setOrderTypeValue
]
=
useState
(
0
);
const
isMateriel
=
isMaterialOrder
(
orderTypeValue
);
const
tableColumn
:
ColumnType
<
any
>
[]
=
[
{
title
:
'订单号'
,
dataIndex
:
'orderNo'
,
render
:
(
text
,
record
)
=>
(
<
a
href=
{
`/memberCenter/afterService/returnApplication/returnPrSubmit/orderDetail?id=${record.orderId}`
}
target=
"_blank"
>
{
text
}
</
a
>
),
},
{
title
:
'订单摘要'
,
dataIndex
:
'digest'
,
ellipsis
:
true
,
},
{
title
:
'供应会员'
,
dataIndex
:
'vendorMemberName'
,
},
{
title
:
'下单时间'
,
dataIndex
:
'createTime'
,
},
{
title
:
'订单状态'
,
dataIndex
:
'outerStatusName'
,
},
{
title
:
'订单类型'
,
dataIndex
:
'orderTypeName'
,
},
isMateriel
?
{
title
:
'合同编号'
,
dataIndex
:
'contractNo'
,
render
:
(
text
,
record
)
=>
(
<
a
href=
{
`/memberCenter/contract/manage/QueryList/QueryListdetails?contractId=${record.contractId}`
}
target=
"_blank"
>
{
text
}
</
a
>
),
}
:
null
,
].
filter
(
Boolean
)
as
ColumnType
<
any
>
[];
const
childTableColumn
:
ColumnType
<
any
>
[]
=
[
!
isMateriel
?{
title
:
'商品ID'
,
dataIndex
:
'productNo'
,
}
:
{
title
:
'物料编号'
,
dataIndex
:
'productNo'
,
},
!
isMateriel
?
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
}
:
{
title
:
'物料名称、规格'
,
dataIndex
:
'name'
,
render
:
(
text
,
record
)
=>
`
${
text
}
/
${
record
.
quotedSpec
}
`
,
},
{
title
:
'品类'
,
dataIndex
:
'category'
,
},
{
title
:
'品牌'
,
dataIndex
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unit'
,
},
{
title
:
'订单数量'
,
dataIndex
:
'quantity'
,
},
{
title
:
'已维修数量'
,
dataIndex
:
'maintainCount'
,
},
];
// 根据采购会员获取订单列表
const
getOrderList
=
(
params
):
Promise
<
OrderListRes
>
=>
{
const
purchaserValue
=
addSchemaAction
.
getFieldValue
(
'purchaser'
);
const
purchaserOriginData
:
GetMemberManageOrderAgentMembersResponse
=
addSchemaAction
.
getFieldState
(
'purchaser'
,
(
fieldState
)
=>
fieldState
.
originData
);
const
current
=
purchaserOriginData
.
find
((
item
)
=>
item
.
id
===
purchaserValue
);
if
(
!
current
)
{
return
Promise
.
reject
();
}
const
{
startDate
=
null
,
endDate
=
null
}
=
params
;
const
payload
=
{
...
params
};
if
(
startDate
)
{
payload
.
startDate
=
moment
(
+
startDate
).
format
(
'YYYY-MM-DD'
);
}
if
(
endDate
)
{
payload
.
endDate
=
moment
(
+
endDate
).
format
(
'YYYY-MM-DD'
);
}
return
new
Promise
((
resolve
,
reject
)
=>
{
getOrderCommonAgentAfterSalePage
({
...
payload
,
buyerMemberId
:
current
.
memberId
,
buyerRoleId
:
current
.
roleId
,
orderType
:
orderTypeValue
,
afterSalesType
:
3
,
// 退货
orderNo
:
detailInfo
.
orderNo
?
detailInfo
.
orderNo
:
params
.
orderNo
||
undefined
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
);
}
reject
();
}).
catch
(()
=>
{
reject
();
});
});
};
const
handleAddGoods
=
()
=>
{
const
purchaserVal
=
addSchemaAction
.
getFieldValue
(
'purchaser'
);
const
orderTypeVal
=
addSchemaAction
.
getFieldValue
(
'orderType'
);
if
(
!
purchaserVal
)
{
message
.
error
(
'请先选择采购会员'
);
return
;
}
if
(
!
orderTypeVal
)
{
message
.
error
(
'请先选择售后订单类型'
);
return
;
}
setVisibleDrawer
(
true
);
};
const
TableAddButton
=
(
<
Button
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddGoods
}
type=
"dashed"
block
>
{
!
isMateriel
?
'选择维修商品'
:
'选择维修物料'
}
</
Button
>
);
const
handleSubmit
=
values
=>
{
const
{
purchaser
,
supplierMember
,
faultFileList
=
[],
repairGoodsList
,
repairAddress
,
orderNo
,
applyNo
,
applyTime
,
innerStatusName
,
outerStatusName
,
...
rest
}
=
values
;
setSubmitLoading
(
true
);
const
purchaserOriginData
:
GetMemberManageOrderAgentMembersResponse
=
addSchemaAction
.
getFieldState
(
'purchaser'
,
(
fieldState
)
=>
fieldState
.
originData
);
const
current
=
purchaserOriginData
.
find
((
item
)
=>
item
.
id
===
purchaser
);
const
userInfo
=
getAuth
();
const
payload
=
{
repairId
:
0
,
// 有 id 表示编辑,0表示新增
memberId
:
current
.
memberId
,
memberRoleId
:
current
.
roleId
,
company
:
current
.
name
,
supplierMemberId
:
userInfo
.
memberId
,
supplierRoleId
:
userInfo
.
memberRoleId
,
supplierName
:
userInfo
.
company
,
repairAddress
:
repairAddress
?
JSON
.
stringify
(
repairAddress
)
:
''
,
faultFileList
:
faultFileList
.
filter
(
item
=>
item
.
status
===
'done'
).
map
(
item
=>
({
fileName
:
item
.
name
,
filePath
:
item
.
url
,
})),
repairGoodsList
:
repairGoodsList
.
map
(({
repairCount
,
brand
,
unit
,
extraData
,
associated
,
shopId
,
shopLogo
,
shopName
,
...
rest
})
=>
({
orderId
:
extraData
.
orderId
,
orderRecordId
:
extraData
.
id
,
repairCount
:
+
repairCount
,
brand
:
brand
||
''
,
unit
:
unit
||
''
,
...
rest
,
})),
...
rest
,
shopId
:
repairGoodsList
[
0
].
shopId
,
shopLogo
:
repairGoodsList
[
0
].
shopLogo
,
shopName
:
repairGoodsList
[
0
].
shopName
,
};
postAsRepairGoodsAgentSave
(
payload
)
.
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setUnsaved
(
false
);
setTimeout
(()
=>
{
history
.
goBack
();
},
800
);
}
else
{
setSubmitLoading
(
false
);
}
})
.
catch
(()
=>
{
setSubmitLoading
(
false
);
});
};
// 删除维修商品项
const
handleRemoveItem
=
(
index
:
number
)
=>
{
const
newGoodsValue
=
[...
goodsValue
];
const
newValue
=
[...
addSchemaAction
.
getFieldValue
(
'repairGoodsList'
)];
const
deleted
=
newValue
.
splice
(
index
,
1
);
addSchemaAction
.
setFieldValue
(
'repairGoodsList'
,
newValue
);
newGoodsValue
.
splice
(
newGoodsValue
.
findIndex
(
item
=>
item
===
deleted
[
0
].
id
),
1
);
setGoodsValue
(
newGoodsValue
);
};
// ArrayTable自定义渲染
const
renderListTableRemove
=
(
index
:
number
)
=>
(
<
Button
shape=
"circle"
icon=
{
<
DeleteOutlined
/>
}
onClick=
{
()
=>
handleRemoveItem
(
index
)
}
/>
);
const
beforeUpload
=
file
=>
{
if
(
file
.
size
/
1024
/
1024
>
20
)
{
message
.
warning
(
'图片大小超过20M'
);
return
Upload
.
LIST_IGNORE
;
}
return
Promise
.
resolve
();
};
const
handleGoodsConfirm
=
values
=>
{
const
preValues
=
addSchemaAction
.
getFieldValue
(
'repairGoodsList'
);
const
value
=
[];
values
.
forEach
(
item
=>
{
const
atom
=
{
orderId
:
item
.
orderId
,
orderNo
:
item
.
orderNo
,
productId
:
item
.
productNo
,
productName
:
item
.
name
,
category
:
item
.
category
,
brand
:
item
.
brand
,
unit
:
item
.
unit
,
purchaseCount
:
item
.
quantity
,
type
:
item
.
type
,
repairReason
:
''
,
extraData
:
{
id
:
item
.
id
,
orderId
:
item
.
orderId
,
remaining
:
item
.
purchaseCount
-
(
item
.
repairCount
||
0
),
// 可维修数量
},
isHasTax
:
item
.
tax
,
taxRate
:
item
.
taxRate
,
contractId
:
item
.
contractId
,
contractNo
:
item
.
contractNo
,
associated
:
!
isMateriel
?
''
:
`
${
item
.
quotedProductNo
}
/
${
item
.
quotedName
}
/
${
item
.
quotedSpec
||
' '
}
/
${
item
.
quotedCategory
}
/
${
item
.
quotedBrand
}
`
,
associatedProductId
:
item
.
quotedProductNo
||
''
,
associatedProductName
:
`
${
item
.
quotedName
||
''
}
`
,
associatedType
:
`
${
item
.
quotedSpec
||
''
}
`
,
associatedCategory
:
item
.
quotedCategory
||
''
,
associatedBrand
:
item
.
quotedBrand
||
''
,
associatedUnit
:
item
.
unit
||
''
,
skuId
:
item
.
skuId
,
skuPic
:
item
.
skuPic
,
shopId
:
item
.
shopId
,
shopLogo
:
item
.
shopLogo
,
shopName
:
item
.
shopName
,
};
value
.
push
(
atom
);
});
// 先过滤掉 value 中没有,preValues 中有的数据
const
concated
=
[...
value
,
...
preValues
.
filter
(
item
=>
value
.
find
(
val
=>
val
.
extraData
.
id
===
item
.
extraData
.
id
))];
const
newData
=
concated
.
filter
((
item
,
index
)
=>
findLastIndex
(
concated
,
val
=>
val
.
extraData
.
id
===
item
.
extraData
.
id
)
===
index
);
if
(
preValues
.
length
)
{
newData
.
reverse
();
}
addSchemaAction
.
setFieldValue
(
'repairGoodsList'
,
newData
);
};
const
handleGoodsChange
=
values
=>
{
setGoodsValue
(
values
);
};
// 采购商搜索
const
handlePurchaserSearch
=
debounce
((
value
:
string
)
=>
{
if
(
!
value
)
{
addSchemaAction
.
setFieldState
(
'purchaser'
,
(
fieldState
)
=>
{
fieldState
.
props
.
enum
=
[];
});
return
;
}
getMemberManageOrderAgentMembers
({
name
:
value
,
}).
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
addSchemaAction
.
setFieldState
(
'purchaser'
,
(
fieldState
)
=>
{
fieldState
.
props
.
enum
=
res
.
data
.
map
((
item
)
=>
({
label
:
`
${
item
.
name
}
/
${
item
.
memberTypeName
}
/
${
item
.
roleName
}
`
,
value
:
item
.
id
,
}));
fieldState
.
originData
=
res
.
data
;
});
}
});
},
300
);
const
OuterStatus
=
(
<
StatusTag
type=
{
REPAIR_OUTER_STATUS_TAG_MAP
[
detailInfo
?.
outerStatus
]
}
title=
{
detailInfo
?.
outerStatusName
}
/>
);
const
InnerStatus
=
(
<
Badge
color=
{
REPAIR_INNER_STATUS_BADGE_MAP
[
detailInfo
?.
innerStatus
]
}
text=
{
detailInfo
?.
innerStatusName
}
/>
);
const
schemaValue
=
useMemo
(()
=>
addSchema
(
orderTypeValue
),
[
orderTypeValue
]);
return
(
<
Spin
spinning=
{
false
}
>
<
PageHeaderWrapper
style=
{
{
padding
:
24
,
}
}
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
title=
"代客维修申请"
extra=
{
[
<
Button
key=
"1"
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
loading=
{
submitLoading
}
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
>
保存
</
Button
>,
]
}
>
<
Card
>
<
NiceForm
value=
{
{
...
detailInfo
,
repairGoodsList
:
repairGoodsList
,
}
}
previewPlaceholder=
" "
expressionScope=
{
{
TableAddButton
,
OuterStatus
,
InnerStatus
,
renderListTableRemove
,
beforeUpload
,
handlePurchaserSearch
,
}
}
components=
{
{
ArrayTable
,
OrderNo
,
}
}
effects=
{
(
$
,
actions
)
=>
{
const
{
setFieldState
}
=
actions
;
createEffects
(
$
,
actions
)
onFormInputChange$
().
subscribe
(()
=>
{
if
(
!
unsaved
)
{
setUnsaved
(
true
);
}
});
onFormInit$
().
subscribe
(()
=>
{
setFieldState
(
'*(applyNo,outerStatus,innerStatus)'
,
field
=>
{
field
.
visible
=
false
;
});
});
onFieldInputChange$
(
'orderType'
).
subscribe
(
fieldState
=>
{
setOrderTypeValue
(
fieldState
.
value
);
});
}
}
onSubmit=
{
handleSubmit
}
actions=
{
addSchemaAction
}
schema=
{
schemaValue
}
/>
</
Card
>
<
GoodsDrawer
title=
{
!
isMateriel
?
'选择维修商品'
:
'选择维修物料'
}
afterType=
{
4
}
visible=
{
visibleDrawer
}
fetchOrderList=
{
getOrderList
}
onClose=
{
()
=>
setVisibleDrawer
(
false
)
}
onConfirm=
{
handleGoodsConfirm
}
checked=
{
goodsValue
}
onChange=
{
handleGoodsChange
}
nestProps=
{
{
NestColumns
:
[
tableColumn
,
childTableColumn
],
}
}
orderType=
{
orderTypeValue
}
/>
<
Prompt
when=
{
unsaved
}
message=
"您还有未保存的内容,是否确定要离开?"
/>
</
PageHeaderWrapper
>
</
Spin
>
);
};
export
default
RepairValetApply
;
src/pages/afterService/repairManage/repairValetApply/schema.ts
0 → 100644
View file @
0b255b50
/*
* @Author: XieZhiXiong
* @Date: 2021-12-03 09:55:11
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-03 10:37:06
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
import
{
PATTERN_MAPS
}
from
'@/constants/regExp'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
import
{
ORDER_TYPE_TENDER_CONTRACT
,
ORDER_TYPE_POINTS
,
ORDER_TYPE_CHANNEL_POINTS
,
}
from
'@/constants/order'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
isMaterialOrder
}
from
'../../utils'
;
const
orderTypeArr
=
GlobalConfig
.
web
.
orderType
.
map
((
item
)
=>
({
label
:
item
.
platformWayName
,
value
:
item
.
id
,
})).
filter
((
item
)
=>
(
item
.
value
!==
ORDER_TYPE_POINTS
&&
item
.
value
!==
ORDER_TYPE_CHANNEL_POINTS
));
const
userInfo
=
getAuth
();
export
const
addSchema
=
(
orderType
:
number
):
ISchema
=>
{
const
isMateriel
=
isMaterialOrder
(
orderType
);
return
{
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
:
12
,
labelAlign
:
'left'
,
},
properties
:
{
applyAbstract
:
{
type
:
'string'
,
title
:
'申请单摘要'
,
'x-rules'
:
[
{
required
:
true
,
message
:
'请填写申请单摘要'
,
},
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
60
,
}
],
},
purchaser
:
{
type
:
'string'
,
title
:
'采购会员'
,
enum
:
[],
'x-component-props'
:
{
showSearch
:
true
,
defaultActiveFirstOption
:
false
,
showArrow
:
false
,
filterOption
:
false
,
onSearch
:
'{{handlePurchaserSearch}}'
},
required
:
true
,
},
supplierMember
:
{
type
:
'string'
,
title
:
'供应会员'
,
default
:
userInfo
.
company
,
editable
:
false
,
},
orderType
:
{
type
:
'string'
,
title
:
'售后订单类型'
,
enum
:
orderTypeArr
,
'x-component-props'
:
{
placeholder
:
'请选择'
,
},
required
:
true
,
},
applyNo
:
{
type
:
'string'
,
title
:
'申请单号'
,
'x-component'
:
'Text'
,
},
applyTime
:
{
type
:
'string'
,
title
:
'单据时间'
,
'x-component'
:
'Text'
,
},
outerStatus
:
{
type
:
'string'
,
title
:
'外部状态'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{OuterStatus}}'
},
},
innerStatus
:
{
type
:
'string'
,
title
:
'内部状态'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{InnerStatus}}'
},
},
},
},
},
},
'tab-2'
:
{
type
:
'object'
,
'x-component'
:
'tabpane'
,
'x-component-props'
:
{
tab
:
'单据明细'
,
},
properties
:
{
MEGA_LAYOUT2
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
labelCol
:
4
,
labelAlign
:
'left'
,
},
properties
:
{
addBtn
:
{
type
:
'object'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{TableAddButton}}'
,
},
},
repairGoodsList
:
{
type
:
'array'
,
'x-component'
:
'ArrayTable'
,
'x-component-props'
:
{
renderAddition
:
()
=>
null
,
renderRemove
:
'{{renderListTableRemove}}'
,
renderMoveDown
:
()
=>
null
,
renderMoveUp
:
()
=>
null
,
operationsWidth
:
100
,
operations
:
{
align
:
'center'
,
},
},
'x-rules'
:
[
{
required
:
true
,
message
:
!
isMateriel
?
'请选择维修商品'
:
'请选择维修物料'
,
},
],
items
:
{
type
:
'object'
,
properties
:
{
...(
!
isMateriel
?
({
orderNo
:
{
type
:
'string'
,
title
:
'订单号'
,
'x-component'
:
'OrderNo'
,
},
productId
:
{
type
:
'string'
,
title
:
'商品ID'
,
'x-component'
:
'Text'
,
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
'x-component'
:
'Text'
,
},
category
:
{
type
:
'string'
,
title
:
'品类'
,
'x-component'
:
'Text'
,
},
brand
:
{
type
:
'string'
,
title
:
'品牌'
,
'x-component'
:
'Text'
,
},
unit
:
{
type
:
'string'
,
title
:
'单位'
,
'x-component'
:
'Text'
,
},
})
:
({
orderNo
:
{
type
:
'string'
,
title
:
'订单号'
,
'x-component'
:
'OrderNo'
,
},
productId
:
{
type
:
'string'
,
title
:
'物料编号'
,
'x-component'
:
'Text'
,
},
productName
:
{
type
:
'string'
,
title
:
'物料名称、规格'
,
'x-component'
:
'Text'
,
},
category
:
{
type
:
'string'
,
title
:
'品类'
,
'x-component'
:
'Text'
,
},
brand
:
{
type
:
'string'
,
title
:
'品牌'
,
'x-component'
:
'Text'
,
},
associatedUnit
:
{
type
:
'string'
,
title
:
'单位'
,
'x-component'
:
'Text'
,
},
associated
:
{
type
:
'string'
,
title
:
orderType
!==
ORDER_TYPE_TENDER_CONTRACT
?
'关联报价商品ID、名称、规格、品类、品牌'
:
'关联投标商品ID、名称、规格、品类、品牌'
,
'x-component'
:
'Text'
,
},
})
),
// 采购数量
purchaseCount
:
{
type
:
'string'
,
title
:
'采购数量'
,
'x-component'
:
'Text'
,
},
repairCount
:
{
type
:
'string'
,
title
:
'维修数量'
,
'x-component-props'
:
{
allowClear
:
true
,
style
:
{
maxWidth
:
150
,
},
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请填写维修数量'
,
},
{
pattern
:
PATTERN_MAPS
.
weight
,
message
:
'请填写正数,最多保留3位小数'
,
},
],
},
repairReason
:
{
type
:
'string'
,
title
:
'维修原因'
,
'x-component-props'
:
{
allowClear
:
true
,
style
:
{
maxWidth
:
150
,
},
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请填写维修原因'
,
},
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
60
,
}
],
},
// 其他数据,不用于展示,只用于收集值
extraData
:
{
type
:
'string'
,
display
:
false
,
},
},
},
},
},
},
},
},
'tab-3'
:
{
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
:
{
faultFileList
:
{
title
:
'附件'
,
'x-component'
:
'FixUpload'
,
'x-component-props'
:
{
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
''
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg'
,
},
'x-rules'
:
[
{
required
:
false
,
message
:
'请上传附件'
,
},
],
description
:
'一次上传一个文件,每个附件大小不能超过20M'
,
},
},
},
},
},
'tab-4'
:
{
type
:
'object'
,
'x-component'
:
'tabpane'
,
'x-component-props'
:
{
tab
:
'维修地址'
,
},
properties
:
{
MEGA_LAYOUT3
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
labelCol
:
4
,
wrapperCol
:
12
,
labelAlign
:
'left'
,
},
properties
:
{
repairAddress
:
{
title
:
'维修地址'
,
type
:
'string'
,
'x-component'
:
'CustomAddressSelect'
,
'x-component-props'
:
{
isDefaultAddress
:
true
,
addressType
:
1
,
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请选择维修地址'
,
},
],
},
},
},
},
},
},
},
},
};
};
\ No newline at end of file
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