Commit 0332bf08 authored by LeeJiancong's avatar LeeJiancong

'物流-平台完善弹窗接口相关对接'

parent d9e36d12
......@@ -37,14 +37,10 @@
"bizcharts": "^4.0.7",
"copy-to-clipboard": "^3.3.1",
"god": "0.1.24",
<<<<<<< HEAD
"lingxi-design-ui": "^1.0.6",
=======
"lingxi-design": "^1.0.7",
"lingxi-design-ui": "^1.0.8",
"lingxi-editor-core": "^1.0.6",
"lingxi-web": "^1.0.6",
>>>>>>> 9f7e1b348f491f1e89c0583cfd65a5497cd43a4e
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
......
......@@ -7,10 +7,13 @@ import { ColumnType } from 'antd/lib/table/interface'
import { StandardTable } from 'god'
import { history } from 'umi'
import ReutrnEle from '@/components/ReturnEle';
import {PublicApi,CustomApi} from '@/services/api'
import {usePageStatus,PageStatus} from '@/hooks/usePageStatus'
import ModalTable from '@/components/ModalTable'
import { PublicApi, CustomApi } from '@/services/api'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index'
import style from "./addCompany.less"
import { ISchema } from '@formily/antd';
export interface companyProps {
}
......@@ -29,25 +32,35 @@ const layout = {
const data = [
{
key: '1',
Name: '山东万达橡胶集团有限公司',
address: '广东省广州市海珠区新港东路1068号'
memberId:1,
name: '名称',
roleName: '角色1',
levelTag:'青铜'
}]
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'key',
dataIndex: 'memberId',
align: 'center',
key: 'key',
key: 'memberId',
},
{
title: '会员名称',
dataIndex: 'Name',
dataIndex: 'name',
key:'name',
align: 'left'
},
{
title: '会员角色',
dataIndex: 'roleName',
key:'roleName',
align: 'center'
},
{
title: '公司地址',
dataIndex: 'address',
title: '会员等级',
dataIndex: 'levelTag',
key:'levelTag',
align: 'center'
}
]
......@@ -65,16 +78,23 @@ const fetchData = (params: any) => {
})
}
// const fetchData = async (params) =>{
// const res = await PublicApi.getMemberManageLowerPageBynamerole(params)
// return res.data
// }
const { Option } = Select;
const defaultValue = 'lucy'
const company: React.FC<{}> = () => {
//hook只能写在函数组件的顶级作用域
const ref = useRef<any>({})
const {pageStatus,id} = usePageStatus()
const { pageStatus, id } = usePageStatus()
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio',customKey:'memberId' })
const [menuForm] = Form.useForm();
const [headerTitle, setHeaderTitle] = useState('新建物流公司')
const [Code, setCode] = useState('')
const [roleList, setroleList] = useState([])
const [codeDisabled, setCodeDisabled] = useState(false)
const [companyType, setCompanyType] = useState<number>(null)
const [memberId, setMemberId] = useState<number>(null)
......@@ -82,8 +102,18 @@ const company: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
useEffect(() => {
let _title = pageStatus === PageStatus.PREVIEW ?'查看': id ?'编辑':'新建'
let _title = pageStatus === PageStatus.PREVIEW ? '查看' : id ? '编辑' : '新建'
setHeaderTitle(`${_title}物流公司`)
PublicApi.getMemberManageRoleList().then(res => {
if(res.code === 1000){
let {data} = res || {}
let list = data.map(v => ({
label: v.roleName,
value: v.roleId
}))
setroleList(list)
}
})
if (id) {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
const data = res.data
......@@ -101,7 +131,12 @@ const company: React.FC<{}> = () => {
const handleSubmitAllSetting = () => {
menuForm.validateFields().then((values: any) => {
if (id) {
values.id = id
PublicApi.postLogisticsCompanyUpdate(values).then(res => {
if (res.code === 1000) {
menuForm.resetFields()
history.goBack()
}
})
} else {
PublicApi.postLogisticsCompanyAdd(values).then(res => {
......@@ -134,6 +169,10 @@ const company: React.FC<{}> = () => {
setCompanyType(value)
if (value == 2) {
setCodeDisabled(true)
menuForm.setFieldsValue({
companyMemberId:'',
name:''
})
} else {
setCodeDisabled(false)
}
......@@ -141,10 +180,13 @@ const company: React.FC<{}> = () => {
const handleSelectOk = () => {
console.log('数据', selectRow);
let IDS = selectRow.map(v => v.key)
console.log('数据', IDS.join(','));
setCode(IDS.join(','))
console.log('数据', productRowCtl);
const selectRow= productRowCtl.selectRow[0]
let {memberId,roleId,name} = selectRow
menuForm.setFieldsValue({
companyMemberId: memberId,
name:name
})
setsVisible(false)
}
const handleSelectCancel = () => {
......@@ -160,11 +202,30 @@ const company: React.FC<{}> = () => {
}
}
const selectBtn = (
<Button style={{ backgroundColor: '#6B778C', borderColor: '#6B778C',color:'white' }} onClick={handleLink}>
<Button style={{ backgroundColor: '#6B778C', borderColor: '#6B778C', color: 'white' }} onClick={handleLink}>
<LinkOutlined />选择
</Button>
)
const formSearch: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
"x-component": "Search",
"x-component-props": {
placeholder: '输入关键字搜索'
}
},
roleId:{
type:'string',
"x-component-props":{
placeholder:'选择会员角色'
},
enum: roleList
}
}
}
return (
<PageHeaderWrapper
......@@ -182,6 +243,7 @@ const company: React.FC<{}> = () => {
name="edit_infomation"
layout="horizontal"
labelAlign="left"
autoComplete="off"
{...layout}
>
......@@ -196,7 +258,7 @@ const company: React.FC<{}> = () => {
message: '选择合作类型!',
},
]}
// initialValue={}
// initialValue={}
>
<Select placeholder="请选择合作类型" value={companyType} onChange={onChangeType}>
<Option value={1}>平台物流服务商</Option>
......@@ -209,7 +271,7 @@ const company: React.FC<{}> = () => {
companyType === 1 ?
<Form.Item
name='memberId'
name='companyMemberId'
label='物流公司代码/
平台会员ID'
rules={[
......@@ -219,7 +281,7 @@ const company: React.FC<{}> = () => {
}
]}
>
<Input className="input_addonAfter" disabled maxLength={20} addonAfter={selectBtn}/>
<Input className="input_addonAfter" disabled maxLength={20} addonAfter={selectBtn} />
</Form.Item>
:
<Form.Item
......@@ -260,19 +322,19 @@ const company: React.FC<{}> = () => {
</Col>
{
(pageStatus !== PageStatus.PREVIEW) &&
<Col span={18}>
<Row>
<Col span={6}></Col>
<Col span={18}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
保存
<Col span={18}>
<Row>
<Col span={6}></Col>
<Col span={18}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24 }}>
保存
</Button>
<Button onClick={handleCancel} style={{ marginTop: 32, marginBottom: 16 }}>
取消
<Button onClick={handleCancel} style={{ marginTop: 32, marginBottom: 16 }}>
取消
</Button>
</Col>
</Row>
</Col>
</Col>
</Row>
</Col>
}
</Row>
</Form>)
......@@ -280,7 +342,7 @@ const company: React.FC<{}> = () => {
</Card>
</Col>
</Row>
<Modal
{/* <Modal
title="选择平台物流服务商"
width='800px'
visible={visible}
......@@ -293,7 +355,6 @@ const company: React.FC<{}> = () => {
<Col span={10}> <Input.Search placeholder="输入关键字进行搜索" /></Col>
<Col span={14}></Col>
</Row>
<StandardTable
columns={columns}
currentRef={ref}
......@@ -303,8 +364,28 @@ const company: React.FC<{}> = () => {
}}
fetchTableData={(params: any) => fetchData(params)}
/>
</Modal> */}
<ModalTable
modalTitle='选择平台物流服务商'
confirm={handleSelectOk}
cancel={handleSelectCancel}
visible={visible}
columns={columns}
rowSelection={productRowSelection}
fetchTableData={params => fetchData(params)}
formilyProps={{
ctx: {
schema: formSearch
}
}}
tableProps={{
rowKey: 'memberId'
}}
>
</ModalTable>
</Modal>
</PageHeaderWrapper>
);
......
/*
* @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-25 14:08:22
* @LastEditTime: 2020-08-26 14:15:33
*/
import React, { ReactNode, useRef } from 'react'
......@@ -70,10 +70,10 @@ const Company: React.FC<{}> = () => {
{
title: '物流公司编码/平台会员ID',
align: 'center',
dataIndex: 'memberId',
key: "memberId",
dataIndex: 'companyMemberId',
key: "companyMemberId",
render: (value: any, recond: any) =>
<>{recond.memberId ? recond.memberId : recond.code}</>
<>{value ? value : recond.code}</>
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment