Commit d3096785 authored by 前端-许佳敏's avatar 前端-许佳敏

仓位跳转

parent 399bb3f4
const mallRoute = {
path: '/',
component: '@/pages/lxMall/layouts/LXMallLayout',
......
......@@ -3,7 +3,9 @@ const mockData = {
code: 1000,
data: {
global: {
logo: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/logo.png',
siteId: 502,
siteUrl: 'http://localhost:4396',
logo: 'https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/4db4e7c5424c471c968ab540bce027f31597319423082.png',
countryList: [
{
name: '简体中文-ZH',
......@@ -26,10 +28,6 @@ const mockData = {
icon: 'http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png'
}
],
menuList: [
{ code: '/memberCenter/commodityAbility', children: [ {code: '/mem'} ] },
{ code: '/memberCenter/commodityAbility/classAndProperty/class' },
]
}
}
}
......
......@@ -29,15 +29,15 @@ const serviceConfig = {
url: '/manage/shop/all',
method: 'get'
},
site: {
url: '/manage/paas/site/all',
method: 'get',
// params: linkage => {
// return {
// id: linkage.id
// }
// }
}
// site: {
// url: '/manage/paas/site/all',
// method: 'get',
// // params: linkage => {
// // return {
// // id: linkage.id
// // }
// // }
// }
},
}
......
......@@ -16,6 +16,9 @@ export const useAsyncSelect = (name, service: () => Promise<any[]>) => {
})
linkage.loading(name)
service().then(res => {
setFieldState(name, state => {
state.originAsyncData = res
})
linkage.loaded(name)
linkage.enum(name, res)
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
......
......@@ -15,10 +15,6 @@ export interface UseType {
export interface UserRegister {
useType: UseType;
<<<<<<< HEAD
useDetail?: any;
=======
>>>>>>> 1e9b352414679e662c2d94fb6725cc5e998b77d3
}
export interface ShopInfo {
......@@ -32,14 +28,8 @@ export interface ShopInfo {
url: string;
}
export interface Site {
id: number;
name: string;
}
export interface Web {
shopInfo: ShopInfo[];
site: Site[];
}
export interface CountryList {
......@@ -48,19 +38,11 @@ export interface CountryList {
icon: string;
}
export interface Children {
code: string;
}
export interface MenuList {
code: string;
children: Children[];
}
export interface Global {
siteId: number;
siteUrl: string;
logo: string;
countryList: CountryList[];
menuList: MenuList[];
}
export interface RootObject {
......
......@@ -14,7 +14,7 @@ import ReutrnEle from '@/components/ReturnEle';
import './index.less'
import NiceForm, {FlexBox} from '@/components/NiceForm'
import { repositDetailSchema, repositMoreSchema, repositSchema, repositTabOneSchema, repositInSchema } from './schema'
import { createFormActions, ISchema, FormButtonGroup, Submit, FormEffectHooks, FormProvider, FormSpy } from '@formily/antd'
import { createFormActions, ISchema, FormButtonGroup, Submit, FormEffectHooks, FormProvider, FormSpy, createAsyncFormActions } from '@formily/antd'
import EyePreview from '@/components/EyePreview'
import { findItemAndDelete, omit } from '@/utils'
import { PublicApi } from '@/services/api'
......@@ -48,7 +48,7 @@ const fetchDepositAllList = async () => {
}
const addSchemaAction = createFormActions()
const repositSchemaAction = createFormActions()
const repositSchemaAction = createAsyncFormActions()
const AddRepository:React.FC<{}> = (props) => {
const ref = useRef<any>({})
......@@ -276,6 +276,14 @@ const AddRepository:React.FC<{}> = (props) => {
<Button type='primary' htmlType='submit'>调入</Button>
</Row>
const topTableChange = (tabs) => {
if (tabs === 'tab2') {
repositSchemaAction.getFieldValue('NO_SUBMIT1').then(data => {
console.log(data)
}) // 调入的数值
}
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
......@@ -291,7 +299,7 @@ const AddRepository:React.FC<{}> = (props) => {
<Card className=''>
<FormProvider>
<Tabs type='card' defaultActiveKey='tab1'>
<Tabs type='card' defaultActiveKey='tab1' onChange={topTableChange}>
<Tabs.TabPane key='tab1' tab='仓位设置'>
<NiceForm
previewPlaceholder='loading...'
......@@ -323,9 +331,22 @@ const AddRepository:React.FC<{}> = (props) => {
onSubmit={handleRespotIn}
effects={($, {setFieldState}) => {
const utils = useLinkageUtils()
useAsyncSelect('freightSpaceId', fetchDepositAllList)
FormEffectHooks.onFormMount$().subscribe(() => {
const name = spyForm.getFieldValue('name')
PublicApi.getWarehouseFreightSpaceAll().then(res => {
const { data } = res
const asyncEnums = data.map(v => ({
label: v.name,
value: v.id
}))
utils.enum('freightSpaceId', asyncEnums)
$('onFieldInputChange', 'freightSpaceId').subscribe(state => {
const numberValue = data.find(v => v.id === state.value).inventory
utils.value('NO_SUBMIT1', numberValue)
})
})
utils.enum('foldFreightSpaceId', [
{label: name, value: id}
])
......
import React, { useEffect } from 'react'
import { ISchemaFormActions, FormEffectHooks } from '@formily/antd';
import { ISchemaFormActions, FormEffectHooks, IFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const { onFieldValueChange$ } = FormEffectHooks
......@@ -19,9 +19,12 @@ export const useWarehouseSelect = (context: ISchemaFormActions) => {
})
}
export const createAddRepositoryEffect = (context) => {
export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
const fetchWarehouseAll = async () => {
const { data } = await PublicApi.getWarehouseWarehouseAll()
context.setFieldState('warehouseId', state => {
state.warehouseLists = data
})
return data.map(v => ({
value: v.id,
label: v.name
......
......@@ -671,7 +671,7 @@ export const repositInSchema: ISchema = {
type: 'string',
title: '调出仓位名称',
enum: [],
// required: true,
required: true,
"x-mega-props": {
span: 1
}
......@@ -693,13 +693,13 @@ export const repositInSchema: ISchema = {
readOnly: true,
title: '当前仓位库存(尺)',
"x-component": 'CircleBox',
default: 20000
default: 0
},
'NO_SUBMIT2': {
type: 'object',
title: '当前仓位库存(尺)',
"x-component": 'CircleBox',
default: 20000
default: 0
},
"foldInventory": {
type: 'number',
......@@ -707,15 +707,8 @@ export const repositInSchema: ISchema = {
"x-component-props": {
width: '80%',
isNumber: true,
max: 20000,
max: 0,
min: 0,
marks: {
0: 0,
5000: 5000,
10000: 10000,
15000: 15000,
20000: 20000
},
layout: {
display: 'flex',
flexDirection: 'column',
......
import { action, computed, observable, runInAction } from 'mobx'
import { ISiteModule } from '@/module/siteModule';
import { GlobalConfig } from '@/global/config';
class SiteStore implements ISiteModule {
@observable public siteId: number = 352; // 站点id
@observable public siteUrl: string = 'https://127.0.0.1:4379'; // 站点域名
// 可在根目录下的demo.js修改数据
@observable public siteId: number = GlobalConfig.global.siteId; // 站点id
@observable public siteUrl: string = GlobalConfig.global.siteUrl; // 站点域名
}
export default SiteStore
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