Commit 121eb5d0 authored by LeeJiancong's avatar LeeJiancong

修改部分状态-查看,编辑

parent 392814eb
......@@ -10,7 +10,6 @@ import ReutrnEle from '@/components/ReturnEle';
import {PublicApi,CustomApi} from '@/services/api'
import { addCompany, updateCompany, getCompanyDetail } from '@/services/logistics/index'
import style from "./addCompany.less"
const { location } = history
export interface companyProps {
}
......@@ -82,8 +81,8 @@ const company: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
useEffect(() => {
let _title = location.query.id == 0? '新建':
location.query.isSee ? '查看': '编辑'
let _title = history.location.query.id == 0? '新建':
history.location.query.isSee ? '查看': '编辑'
setHeaderTitle(`${_title}物流公司`)
if (id !== '0') {
PublicApi.getLogisticsCompanyGet({ id: id }).then(res => {
......@@ -184,6 +183,7 @@ const company: React.FC<{}> = () => {
{
(<Form
form={menuForm}
colon={false}
name="edit_infomation"
layout="horizontal"
labelAlign="left"
......@@ -237,7 +237,7 @@ const company: React.FC<{}> = () => {
}
]}
>
<Input disabled maxLength={20} />
<Input maxLength={20} />
</Form.Item>
}
</Col>
......
/*
* @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-24 16:25:17
* @LastEditTime: 2020-07-24 17:54:55
*/
import React, { ReactNode, useRef } from 'react'
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-24 16:31:22
* @LastEditTime: 2020-07-24 19:48:44
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -79,6 +79,7 @@ const dropdownRender = () => {
const diaLogForm: React.FC<ListProps> = (props) => {
const type: string = history.location.query.type
const [areaCode, setAreaCode] = useState<number>(null)
const [Options, setOptions] = useState([])
const [state, setState] = useState({ editable: true })
const [headerTitle, setHeaderTitle] = useState('')
......@@ -112,6 +113,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
}
})
} else {
value.id = id
PublicApi.postLogisticsShipperAddressUpdate(value).then(res => {
if (res.code == 1000) {
}
......@@ -124,6 +126,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
}
})
} else {
value.id = id
PublicApi.postLogisticsReceiverAddressUpdate(value).then(res => {
if (res.code == 1000) {
}
......@@ -160,7 +163,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
let _Options: any = []
List.forEach((item: any, index: number) => {
let tem = <><img src={item} key={'item' + index} style={{ width: _width, height: _height }} /> +86</>
_Options.push({ label: tem, value: index + 1 })
_Options.push({ label: tem, value: (index + 1).toString() })
})
/**
......@@ -169,8 +172,9 @@ const diaLogForm: React.FC<ListProps> = (props) => {
* @return:
*/
useEffect(() => {
const id = history.location.query.id
let title = id == 0 ? '新建' : '编辑'
const id = Number(history.location.query.id)
console.log(typeof(id))
let title = id === 0 ? '新建' : '编辑'
history.location.query.type == '1' ? setHeaderTitle(`${title}发货地址`) : setHeaderTitle(`${title}收货地址`)
setOptions(_Options)
PublicApi.getLogisticsShipperAddressGetTelCode().then(res => {})
......@@ -181,8 +185,8 @@ const diaLogForm: React.FC<ListProps> = (props) => {
})
setProvinceList(list)
})
if (location.query.id != 0 && location.query.type == '1') {
PublicApi.getLogisticsShipperAddressGet({ id: id }).then(res => {
if (id !== 0 && location.query.type == '1') {
PublicApi.getLogisticsShipperAddressGet({ id: id.toString() }).then(res => {
if (res.code == 1000) {
let data = res.data
Object.keys(data).forEach(key => {
......@@ -191,6 +195,9 @@ const diaLogForm: React.FC<ListProps> = (props) => {
if (key == 'isDefault') {
state.value = data[key] === 0 ? false : true
}
// else if(key == 'areaCode'){
// setAreaCode(Number(data[key]))
// }
})
})
}
......@@ -198,8 +205,8 @@ const diaLogForm: React.FC<ListProps> = (props) => {
}
//收货
if (location.query.id != 0 && location.query.type == '2') {
PublicApi.getLogisticsReceiverAddressGet({ id: id }).then(res => {
if (id === 0 && location.query.type == '2') {
PublicApi.getLogisticsReceiverAddressGet({ id: id.toString() }).then(res => {
if (res.code == 1000) {
let data = res.data
Object.keys(data).forEach(key => {
......@@ -273,11 +280,12 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<Row>
<Col span={16}>
<SchemaForm editable={state.editable}
// initialValues={{
// provinceId: '',
// cityId:'111120',
// districtId:'121212'
// }}
initialValues={{
// areaCode: areaCode
// provinceId: '',
// cityId:'111120',
// districtId:'121212'
}}
actions={actions}//要传递
components={{
Input, Select, TextArea: Input.TextArea, Switch
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-24 16:52:18
* @LastEditTime: 2020-07-24 20:10:56
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -58,7 +58,7 @@ export interface ListType {
* @param {type}
* @return:
*/
const { location } = history
const actions = createFormActions()
const { ON_FORM_SUBMIT } = LifeCycleTypes //拿到Form提交API
const onFormSubmit$ = FormEffectHooks
......@@ -113,14 +113,17 @@ const diaLogForm: React.FC<ListProps> = (props) => {
* @return:
*/
useEffect(() => {
let id = location.query.id
let _title = id == 0? '新建':
location.query.isSee ? '查看': '编辑'
let id = history.location.query.id
let _title = history.location.query.isSee ? '查看':
Number(id) === 0? '新建':'编辑'
// console.log(id,typeof id,history.location.query.isSee,typeof history.location.query.isSee)
setHeaderTitle(`${_title}运费模板`)
PublicApi.getWarehouseAreaByPcodeAll({ pcode: '100000' }).then(res => {
let list = []
res.data.forEach((item: any, index: number) => {
list.push({ label: item.name, value: item.code })
list.push({ label: item.name, value: Number(item.code) })
})
setProvinceList(list)
})
......@@ -130,10 +133,8 @@ const diaLogForm: React.FC<ListProps> = (props) => {
let data = res.data
Object.keys(data).forEach(key => {
actions.setFieldState(key, state => {
console.log(111,key)
state.value = data[key]
// if (key == 'isDefault') {
// state.value = data[key] === 0 ? false : true
// }
})
})
}
......@@ -153,7 +154,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
{ label: <><img src={us} key='5' style={{ width: _width, height: 17 }} /> +86</>, value: '5' }
]
const FormSumbit = (values: any) => {
let id = location.query.id
let id = history.location.query.id
let value = { ...values }
if(id == 0){
PublicApi.postLogisticsFreightTemplateAdd(value).then(res => {})
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-14 15:07:34
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-24 16:20:16
* @LastEditTime: 2020-07-24 20:08:29
*/
import React, { Component, ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
......@@ -238,7 +238,7 @@ const Template: React.FC<ListProps> = (props) => {
}
]
const handleSee = (id: number) => {
history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?id=${id}&isSee=true`)
history.push(`/memberCenter/logisticsAbility/logistics/list/templateForm?id=${id}&isSee=${true}`)
}
const confirm = () => {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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