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

仓位跳转

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