Commit d3aa0f39 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

merge-n

parents c4b50366 24c2bbf5
......@@ -22,4 +22,8 @@
# mockStatic
/.idea
src/services/index.ts
config/base.config.json
/src/services/index.ts
.vscode
This diff is collapsed.
const MAIN_COLOR = '#00B37A'
const MAIN_FONT_BOLD_COLOR = '#172B4D'
const MAIN_FONT_TINY_COLOR = '#6B778C'
export default {
'@primary-color': '#00B37A',
'@primary-color': MAIN_COLOR,
// 公共padding变量
'@padding-lg': '24px',
......@@ -13,4 +17,11 @@ export default {
'@margin-sm': '12px',
'@margin-xs': '8px',
'@margin-xss': '4px',
// tabs
'tabs-card-active-color': MAIN_FONT_BOLD_COLOR,
'tabs-highlight-color': MAIN_FONT_BOLD_COLOR,
'tabs-hover-color': MAIN_FONT_BOLD_COLOR,
'tabs-active-color': MAIN_FONT_BOLD_COLOR,
'tabs-card-head-background': '#fff',
}
export default {
'/api': {
'target': 'http://10.0.0.25:8900/',
'target': 'http://10.0.0.25:8100/',
'changeOrigin': true,
'pathRewrite': { '^/api' : '' },
}
......
......@@ -7,9 +7,10 @@
import CommodityRoute from './commodityRoute' // 商品能力路由
import MemberRoute from './memberRoute' // 会员能力路由
import ShopRoute from './shopRoute' // 店铺能力路由
import TranactionRoute from './tranactionRoute' // 交易能力路由
import LogisticsRoute from './logisticsRoutes' // 物流能力路由
const routes = [CommodityRoute, MemberRoute, ShopRoute, LogisticsRoute]
const routes = [CommodityRoute, MemberRoute, ShopRoute, TranactionRoute, LogisticsRoute]
const memberCenterRoute = {
path: '/memberCenter',
......
const TranactionRoute = {
path: '/memberCenter/tranactionAbility',
name: 'tranactionAbility',
key: 'tranactionAbility',
icon: 'smile',
routes: [
{
path: '/memberCenter/tranactionAbility/stockSellStorage',
name: 'stockSellStorage',
key: 'stockSellStorage',
routes: [
{
path: '/memberCenter/tranactionAbility/stockSellStorage/warehouse',
name: 'warehouse',
key: 'warehouse',
component: '@/pages/transaction/stockSellStorage/warehouse/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/billsType',
name: 'billsType',
key: 'billsType',
component: '@/pages/transaction/stockSellStorage/billsType/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/bills',
name: 'bills',
key: 'bills',
component: '@/pages/transaction/stockSellStorage/bills/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/inventory',
name: 'inventory',
key: 'inventory',
component: '@/pages/transaction/stockSellStorage/inventory/index',
},
]
}
]
}
export default TranactionRoute
......@@ -26,12 +26,12 @@
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@ant-design/pro-layout": "^5.0.16",
"@formily/antd": "^1.2.8",
"@formily/antd-components": "^1.2.8",
"@formily/antd": "^1.2.10",
"@formily/antd-components": "^1.2.10",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.0",
"bizcharts": "^4.0.7",
"god": "0.1.15",
"god": "^0.1.17",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
......
import React from 'react'
import { Link } from 'umi'
import { EyeOutlined } from '@ant-design/icons'
import { Button } from 'antd'
export interface EyePreviewProps {
url?: string,
type?: 'button' | 'link',
handleClick?()
}
const EyePreview:React.FC<EyePreviewProps> = (props) => {
return (
props.type === 'link' ?
<Link to={props.url || ''}>
{props.children} <EyeOutlined />
</Link>
:
<Button onClick={props.handleClick} type='link'>
{props.children} <EyeOutlined />
</Button>
)
}
EyePreview.defaultProps = {
type: 'link'
}
export default EyePreview
\ No newline at end of file
import React from 'react'
import { Row, Col } from 'antd';
import styled from 'styled-components'
import { findItemAndDelete } from '@/utils'
import cx from 'classnames'
const RowStyleLayout = styled(props => <div {...props} />)`
.card-checkbox {
display: flex;
flex-wrap: wrap;
}
.card-checkbox-item {
width: 320px;
height: 48px;
margin-right: 32px;
margin-bottom: 16px;
border:1px solid rgba(235,236,240,1);
padding: 0 16px;
display: flex;
align-items: center;
cursor: pointer;
}
.card-checkbox-item.active {
border-color: #00B382;
position: relative;
}
.card-checkbox-item.active::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 0;
border: 6px solid transparent;
border-right: 6px solid #00B382;
border-bottom: 6px solid #00B382;
}
.card-logo {
display: block;
width: 32px;
height: 32px;
border-radius: 50%;
margin-right: 8px;
}
.card-logo.default {
background: #669EDE;
text-align: center;
line-height: 32px;
color: #fff;
font-size: 12px;
}
.card-checkbox-title {
font-size: 14px;
color: #42526E;
}
`
const CardCheckBox = (props) => {
const { dataSource = [] } = props.props['x-component-props']
const value: number[] = props.value || []
const handleChange = (id) => {
if (value.includes(id)) {
const newValue = findItemAndDelete(value, id)
props.mutators.change(newValue)
} else {
props.mutators.change([...value, id])
}
}
const isChecked = (id) => {
return value.includes(id)
}
return (
<RowStyleLayout>
<Row className='card-checkbox'>
{
dataSource.map((v, i) => {
return (
<Col key={v.id} className={cx('card-checkbox-item', isChecked(v.id) ? 'active' : '')} onClick={() => handleChange(v.id)}>
{ v.logo ? <img className='card-logo' src={v.logo}/> : <div className='card-logo default'>logo</div> }
<span className='card-checkbox-title'>{v.title}</span>
</Col>
)
})
}
</Row>
</RowStyleLayout>
)
}
CardCheckBox.defaultProps = {}
CardCheckBox.isFieldComponent = true;
export default CardCheckBox
\ No newline at end of file
import React from 'react'
import styled from 'styled-components'
import { toArr } from '@formily/shared';
import { SchemaField, FormPath } from '@formily/antd';
import { Button } from 'antd';
// 由于自增列表里 无法进行mega布局, 所以只能在该组件下 重写样式
const RowStyleLayout = styled(props => <div {...props} />)`
.ant-btn {
margin-right: 16px;
}
.ant-form-item {
display: inline-flex;
margin-right: 16px;
margin-bottom: 16px;
}
> .ant-form-item {
margin-bottom: 20px;
margin-right: 20px;
}
> .ant-form-item:last-child {
margin-right: 0;
}
.ant-form-item-control {
max-width: none;
}
`
// 自增组件
const CustomAddArray = (props) => {
const { value, schema, className, editable, path, mutators } = props
const componentProps = schema.getExtendsComponentProps() || {}
const onAdd = () => mutators.push(schema.items.getEmptyValue())
const onRemove = index => mutators.remove(index)
return <div>
{ toArr(value).map((item, index, arr) => {
return <RowStyleLayout {...componentProps} key={index}>
<SchemaField path={FormPath.parse(path).concat(index)} onlyRenderProperties/>
<Button onClick={onAdd.bind(null, index)} type='primary'>+</Button>
{ index !== 0 && <Button onClick={onRemove.bind(null, index)}>-</Button>}
</RowStyleLayout>
}) }
</div>
}
CustomAddArray.isFieldComponent = true
export default CustomAddArray
import React from 'react'
import { Slider, Input, Space } from 'antd'
const CustomSlider = (props) => {
const value = props.value || 0
const max = props.props['x-component-props']?.max || 0
return (
<div style={{width: '100%'}}>
<Slider
value={value}
onChange={e => props.mutators.change(e)}
{...props.props['x-component-props']}></Slider>
<Space>
<Input type='number' disabled max={max} value={props.value} onChange={e => props.mutators.change(e.target.value)} addonAfter='尺'/>
{ max && <span>还剩:{max - value}</span> }
</Space>
</div>
)
}
CustomSlider.defaultProps = {}
CustomSlider.isFieldComponent = true;
export default CustomSlider
\ No newline at end of file
import React from 'react'
import { Space } from 'antd'
const CustomStatus = (props) => {
return (
<>
<Space>
<span className={ props.value === 1 ? 'commonStatusValid' : 'commonStatusInvalid' }></span>
<span>
{ props.value === 1 ? '有效' : '无效' }
</span>
</Space>
</>
)
}
export default CustomStatus
\ No newline at end of file
import React from 'react'
import UploadImage from "@/components/UploadImage"
const CustomUpload = (props) => {
const { mutators } = props
return <UploadImage
imgUrl={props.value}
onChange={data => {
// 这里能拿到change后的data值
mutators.change(data)
}}
/>
}
CustomUpload.isFieldComponent = true
export default CustomUpload
\ No newline at end of file
import React, { useState } from 'react'
import { Input, Space, Button, Table } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
const MultTable = (props) => {
const { columns } = props.props['x-component-props']
const value = props.value || []
return (
<div style={{width: '100%'}}>
<Button block icon={<PlusOutlined/>} type='dashed'>选择指定会员</Button>
<Table
rowKey='id'
columns={columns}
dataSource={value}
/>
</div>
)
}
MultTable.defaultProps = {}
MultTable.isFieldComponent = true;
export default MultTable
\ No newline at end of file
import React, { useState } from 'react'
import { Input, Space, Button } from 'antd'
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons'
import { useFieldState, FormPath } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
export interface SearchProps {
value: string,
mutators: any,
props: any
}
const Search = (props) => {
const [state, setState] = useFieldState({
filterSearch: false
})
const changeFilterVisible = () => {
if (state.filterSearch) {
props.form.reset({
// 清除FILTER_PARAMS下所有字段
selector: `*.${FORM_FILTER_PATH}.*`
})
}
setState({
filterSearch: !state.filterSearch
})
}
return (
<Space size={20} style={{justifyContent: 'flex-end', width: '100%'}}>
<Input.Search
value={props.value || ''}
onChange={e => props.mutators.change(e.target.value)}
onSearch={(_,e) => {
e.preventDefault()
props.form.submit()
}}
{...props.props['x-component-props']}
/>
<Button onClick={changeFilterVisible}>高级筛选{state.filterSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
<Button onClick={() => props.form.reset()}>重置</Button>
</Space>
)
}
Search.defaultProps = {}
Search.isFieldComponent = true;
export default Search
\ No newline at end of file
import React, { useState } from 'react'
import { Input, Space, Button } from 'antd'
const Submit = (props) => {
return (
<Button htmlType='submit' type='primary'>查询</Button>
)
}
Submit.defaultProps = {}
Submit.isFieldComponent = true;
export default Submit
\ No newline at end of file
import React from 'react'
const Text = (props) => {
return (
<span {...props.props['x-component-props']}>{props.value}</span>
)
}
Text.defaultProps = {}
Text.isFieldComponent = true;
export default Text
\ No newline at end of file
import React from 'react'
import SchemaForm, { IAntdSchemaFormProps, createFormActions, FormPath, SchemaField } from '@formily/antd'
import { Button, Space } from 'antd';
import CustomUpload from './components/CustomUpload';
import CustomStatus from './components/CustomStatus';
import CustomAddArray from './components/CustomAddArray';
import CustomSlider from './components/CustomSlider';
import Search from './components/Search';
import Submit from './components/Submit';
import Text from './components/Text';
import CardCheckBox from './components/CardCheckBox';
import MultTable from './components/MultTable';
export interface NiceFormProps extends IAntdSchemaFormProps {
}
const NiceForm:React.FC<NiceFormProps> = (props) => {
const { children, components, ...reset } = props
const customComponents = {
CustomUpload,
CustomStatus,
CustomAddArray,
CustomSlider,
Search,
Submit,
Text,
CardCheckBox,
MultTable
}
const defineComponents = Object.assign(customComponents, components)
return (
<SchemaForm
colon={false}
components={defineComponents}
{...reset}
>
{children}
</SchemaForm>
)
}
NiceForm.defaultProps = {}
export default NiceForm
\ No newline at end of file
import React from 'react'
import { Popconfirm, Button } from 'antd'
import { PlayCircleOutlined } from '@ant-design/icons'
export interface StatusSwitchProps {
record: any,
handleConfirm?(),
handleCancel?()
}
const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
const { record } = props
return (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={props.handleConfirm}
onCancel={props.handleCancel}
okText="是"
cancelText="否"
>
<Button type="link" style={record.state===1?{color:'#00B37A'}:{color:'red'}}>{record.state===1?'有效':'无效'} <PlayCircleOutlined /></Button>
</Popconfirm>
)
}
StatusSwitch.defaultProps = {}
export default StatusSwitch
\ No newline at end of file
.upload_image_wrap {
display: flex;
align-items: center;
.size_require {
color: #97A0AF;
}
.upload_btn {
width: 104px;
height: 104px;
display: flex;
margin-right: 24px;
align-items: center;
justify-content: center;
color: #6B778C;
flex-direction: column;
background: rgba(250, 251, 252, 1);
border-radius: 2px;
border: 1px solid rgba(223, 225, 230, 1);
cursor: pointer;
overflow: hidden;
&.isAdd {
border: 1px dashed rgba(223, 225, 230, 1);
}
&>img {
height: 100%;
width: auto;
display: block;
margin: 0 auto;
}
&>p {
margin-top: 12px;
}
}
}
\ No newline at end of file
import React, { useState, Fragment, forwardRef } from 'react'
import { Upload, message } from 'antd'
import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'
import { UploadFile, UploadChangeParam } from 'antd/lib/upload/interface'
import cx from 'classnames'
import styles from './index.less'
interface UploadImagePorpsType {
imgUrl: string;
size?: string;
onChange: Function;
disabled?: boolean;
}
const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => {
const { imgUrl, onChange, size = "386x256", disabled = false } = props
const [loading, setLoading] = useState<boolean>(false)
const beforeUpload = (file: UploadFile) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!');
}
const isLt200k = file.size / 1024 < 200;
if (!isLt200k) {
message.error('上传图片不超过200K!');
}
return isJpgOrPng && isLt200k;
}
const uploadProps = {
name: 'file',
action: '/api/file/file/upload',
headers: {},
data: {
fileType: 1
},
disabled: loading || disabled,
showUploadList: false,
onChange(info: UploadChangeParam) {
if (info.file.status === 'uploading') {
setLoading(true)
return;
}
if (info.file.status === 'done') {
// 图片回显
const { code, data } = info.file.response
if (code === 1000) {
console.log('upload success')
onChange(data)
}
setLoading(false)
}
},
beforeUpload
};
const uploadButton = (
<Fragment>
{loading ? <LoadingOutlined /> : <PlusOutlined />}
<p>上传图片</p>
</Fragment>
);
return (
<div className={styles.upload_image_wrap}>
<Upload {...uploadProps}>
{<div className={cx(styles.upload_btn, !imgUrl ? styles.isAdd : "")}>
{
imgUrl ? <img src={imgUrl} /> : uploadButton
}
</div>}
</Upload>
<div className={styles.size_require}>
<p>支持JPG/PNG/JPEG, <br />最大不超过 200K, <br />尺寸:{size}</p>
</div>
</div>
)
})
export default UploadImage
/*
* @Author: LeeJiancong
* @Date: 2020-07-22 09:54:50
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 19:28:23
*/
/**
* 正则表达式集合
*/
......@@ -8,5 +14,6 @@ export const PATTERN_MAPS = {
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/
money:/^\d*(?:\.\d{0,2})?$/,
weight:/^\d*(?:\.\d{0,3})?$/,
}
\ No newline at end of file
export const FORM_FILTER_PATH = 'FORM_FILTER_PATH'
\ No newline at end of file
import { useValueLinkageEffect, ISchemaFormActions, ISchemaFormAsyncActions } from "@formily/antd"
/**
* @param origin 触发联动的字段路径
* @param target 关联的字段路径
*/
export const useStateFilterSearchLinkageEffect = (context, actions: ISchemaFormActions | ISchemaFormAsyncActions, origin: string, target: string) => {
const { setFieldState, reset } = actions
context('onFieldChange', origin).subscribe(state => {
setFieldState(target, fieldState => {
fieldState.visible = state.filterSearch
})
})
}
\ No newline at end of file
import { createFormActions, FormEffectHooks } from '@formily/antd'
import { useLinkageUtils } from '@/utils/formEffectUtils'
/**
* 定义表单副作用的集合
*/
const { onFieldValueChange$ } = FormEffectHooks
export const usePublicSelectEffects = context => {
const linkage = useLinkageUtils()
onFieldValueChange$('select').subscribe(({ value }) => {
linkage.visible(value)
})
}
\ No newline at end of file
......@@ -30,4 +30,10 @@
margin-right: 24px;
}
}
// 设置formitem的*号到字段label前
.ant-form-item-label > label.ant-form-item-required::before {
order: 10;
margin-left: -6px;
}
}
\ No newline at end of file
import { history } from 'umi'
import { useState } from 'react'
export enum PageStatus {
ADD,
EDIT,
PREVIEW
}
export const usePageStatus = () => {
const { preview, id = '' } = history.location.query
// 默认预览状态
let pageStatus = PageStatus.PREVIEW
if (preview === '1') {
pageStatus = PageStatus.PREVIEW
} else {
if (id) {
pageStatus = PageStatus.EDIT
} else {
pageStatus = PageStatus.ADD
}
}
return {
pageStatus,
id,
preview
}
}
\ No newline at end of file
......@@ -46,8 +46,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
settings,
location,
} = props;
console.log(props)
const defaultSetting: Settings = {
navTheme: 'dark',
// 拂晓蓝
......
......@@ -65,6 +65,14 @@ export default {
'menu.shopAbility.shopInfoManage': '店铺信息',
'menu.shopAbility.shopTemplate': '店铺装修模板',
// 交易能力
'menu.tranactionAbility': '交易',
'menu.tranactionAbility.stockSellStorage': '进销存',
'menu.tranactionAbility.stockSellStorage.warehouse': '仓库',
'menu.tranactionAbility.stockSellStorage.billsType': '单据类型',
'menu.tranactionAbility.stockSellStorage.bills': '单据',
'menu.tranactionAbility.stockSellStorage.inventory': '库存',
//物流能力
'menu.logisticsAbility': '物流',
'menu.logisticsAbility.logistics': '物流管理',
......
......@@ -15,10 +15,12 @@ export interface IProductSelectAttribute {
export interface IProductModule {
attributeLists: any[];
productName: string;
productSelectAttribute: IProductSelectAttribute[];
productSelectAttribute: IProductSelectAttribute[]; //商品属性传输数据
selectedGoods: GetProductGoodsGetGoodsListResponseDetail[];
tableDataSource: any[];
priceAttributeParams: any[]; // 价格设置的传输数据
productAttributeAndImageParams: any[]; //价格属性包含图片的传输数据
areaOption: any[]; // 省市数据
setAttributeLists(lists: any[]): void;
setProductName(name: string): void;
......@@ -27,4 +29,6 @@ export interface IProductModule {
setTableDataSource<T>(datas: T[]): void;
clearData(data: any[]): void;
setPriceAttributeParams<T>(datas: T[]): void;
setProductAttributeAndImageParams(datas: any[]): void;
setAreaOption(datas: any[]): void;
}
export interface ISiteModule {
siteId: number;
}
......@@ -220,18 +220,18 @@ const AddAtttribute: React.FC<{}> = () => {
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={isSee}>必填</Checkbox></Form.Item>
</Col>
<Col span={24}>
{/* <Col span={24}>
<Form.Item name="isImage" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={isSee}>上传图片</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值可以上传属性值的对应图片!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
</Col> */}
{/* <Col span={24}>
<Form.Item name="isName" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={isSee}>名称属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值会将属性值添加到商品名称之后,中间以/区隔!">
<InfoCircleOutlined />
</Tooltip>
</Col>
</Col> */}
<Col span={24}>
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={isSee}>价格属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的每个属性值会在商品发布时按属性设置不同的价格!">
......
......@@ -140,7 +140,7 @@ const ClassProperty: React.FC<{}> = () => {
useEffect(()=>{
//@ts-ignore
treeForm.setFieldsValue({categoryKey: selectLinkRow && selectLinkRow.key, categoryName: selectLinkRow && selectLinkRow.name })
treeForm.setFieldsValue({category: {id: selectLinkRow && selectLinkRow.key}, categoryName: selectLinkRow && selectLinkRow.name })
}, [selectLinkRow])
const initGetCategoryTree = () => {
......@@ -341,7 +341,7 @@ const ClassProperty: React.FC<{}> = () => {
<Col span={14}>
<Form.Item
name='name'
label='品类名称'
label={<>品类名称&nbsp;&nbsp;</>}
rules={[
{
required: true,
......@@ -355,7 +355,7 @@ const ClassProperty: React.FC<{}> = () => {
<Col span={14}>
<Form.Item
name='type'
label='品类类型'
label={<>品类类型&nbsp;&nbsp;</>}
rules={[
{
required: true,
......@@ -398,7 +398,7 @@ const ClassProperty: React.FC<{}> = () => {
>
<Row>
<Col span={20}>
<Form.Item name='categoryKey' style={{display:'none'}}>
<Form.Item name={['category','id']} style={{display:'none'}}>
<Input disabled />
</Form.Item>
<Form.Item name='categoryName'>
......@@ -444,7 +444,7 @@ const ClassProperty: React.FC<{}> = () => {
{
//@ts-ignore
onSelect: (key: string, item: any) => {
// console.log(key, item);
console.log(key, item);
// @ts-ignore
setSelectLinkKeys(key);
setSelectLinkRow(item)
......
import React, { useState, useRef, useEffect, createContext } from 'react'
import { history } from 'umi';
import { Button, Card, Tabs } from 'antd'
import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
......@@ -14,15 +14,20 @@ import PriceAttributeForm from './addProductsItem/priceAttributeForm'
import LogisticsForm from './addProductsItem/logisticsForm';
import OtherForm from './addProductsItem/otherForm';
import ProductImageForm from './addProductsItem/productImageForm';
import ProductDescForm from './addProductsItem/productDescForm';
import ProductDescFormOne from './addProductsItem/productDescFormOne';
import { store } from '@/store'
import { PublicApi } from '@/services/api';
const { TabPane } = Tabs
const AddProducts: React.FC<{}> = (props) => {
const [isEnableCheck, setIsEnableCheck] = useState(true)
const [responseId, setReponseId] = useState<number>(null)
const [attributeList, setAttributeList] = useState<any[]>([])
let [formRefs, setFormRefs] = useState([]) //子form的ref数组
const { ProductStore } = store
const { productSelectAttribute, productAttributeAndImageParams, areaOption } = ProductStore
const onSave = () => {
console.log('点击保存')
......@@ -30,17 +35,93 @@ const AddProducts: React.FC<{}> = (props) => {
if(formRefs.length > 0){
try{
let data = formRefs.map(async __ => {
return ( await __.current.validateFields())
return (
await __.current.validateFields()
)
})
console.log(data)
// let vaild = data.every(__ => Boolean(__))
// return vaild ? data :vaild
console.log(data,'data')
Promise.all(data).then((values) => {
// 提交的数据进行处理
console.log(values, productSelectAttribute, productAttributeAndImageParams, '所有数据')
productSelectAttribute.length>0 && productSelectAttribute.map(_itme => {
delete _itme.attributeName
delete _itme.isPrice
})
if(productAttributeAndImageParams.length>0){
productAttributeAndImageParams.map(_item => {
if(_item.goodsCustomerAttributeList.length>0){
_item.goodsCustomerAttributeList.map(__item => {
delete __item.customerAttributeName
})
}
if(_item.commodityPic.length>0){
_item.commodityPic = _item.commodityPic.map(__item => {
return __item?.response?.data
})
}else{
return message.error("每项请至少上传一张商品图片!")
}
})
}
else{
return message.error("每项请至少上传一张商品图片!")
}
// productAttributeAndImageParams.length>0 && productAttributeAndImageParams.map(_item => {
// if(_item.goodsCustomerAttributeList.length>0){
// _item.goodsCustomerAttributeList.map(__item => {
// delete __item.customerAttributeName
// })
// }
// if(_item.commodityPic.length>0){
// _item.commodityPic = _item.commodityPic.map(__item => {
// return __item?.response?.data
// })
// }else{
// console.log(13213)
// return message.error("每项请至少上传一张商品图片!")
// }
// })
let _bacsicForm = {...values[0]}
_bacsicForm.customerCategoryId = _bacsicForm.customerCategoryId[_bacsicForm.customerCategoryId.length-1]
let _params = {..._bacsicForm, ...values[2], logistics: {...values[3]}, ...values[4], customerAttributeList: productSelectAttribute, unitPriceAndPicList: productAttributeAndImageParams}
_params.minOrder = Number(_params.minOrder)
_params.logistics.weight = Number(_params.logistics.weight)
// 处理地址
let _commodityAreaList:any = []
_params.commodityAreaList.length > 0 && _params.commodityAreaList.map(_itme => {
let _temp: any = {}
let pobj = areaOption.filter(_=>_.code===_itme[0])[0]
let cobj = pobj.areaResponses.filter(__=>__.code===_itme[1])[0]
_temp.provinceCode = pobj.code
_temp.provinceName = pobj.name,
_temp.cityCode = cobj.code,
_temp.cityName = cobj.name,
_commodityAreaList.push(_temp)
console.log(_itme, _temp, '地址的每一项')
})
_params.commodityAreaList = _commodityAreaList
console.log(_params,'_params')
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
console.log(res, 'res')
setIsEnableCheck(false)
//@ts-ignore
setReponseId(res.data)
})
}).catch(error => {
message.error("请完善表单必填项!")
console.log(error, '_error')
})
}catch(e){
console.log(e,'error')
}
}
}
const handleApplyCheck = () => {
PublicApi.postProductCommodityApplyCheckCommodity({id: responseId})
}
const callback = (key: any) => {
console.log(key)
}
......@@ -50,7 +131,7 @@ const AddProducts: React.FC<{}> = (props) => {
backIcon={<ReutrnEle description="返回" />}
title="新建商品"
extra={[
<Button key="2">直接提交审核</Button>,
<Button key="2" disabled={isEnableCheck} onClick={handleApplyCheck}>直接提交审核</Button>,
<Button key="1" type="primary" icon={<SaveOutlined />} onClick={onSave}>
保存
</Button>,
......@@ -58,37 +139,37 @@ const AddProducts: React.FC<{}> = (props) => {
>
<Card>
<Tabs onChange={callback} type="card" defaultActiveKey="1">
<TabPane tab="基本信息" key="11">
<TabPane tab="基本信息" key="1">
<BasicInfoForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
onChangeAttributeList={(_lists: any)=>setAttributeList(_lists)} />
</TabPane>
<TabPane tab="选择货品" key="22">
<TabPane tab="选择货品" key="2">
<SelectGoodsForm />
</TabPane>
<TabPane tab="商品属性" key="33">
<TabPane tab="商品属性" key="3">
<ProductAttributeForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
attributesData={attributeList}
/>
</TabPane>
<TabPane tab="价格设置" key="44">
<TabPane tab="价格设置" key="4">
<PriceAttributeForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
/>
</TabPane>
<TabPane tab="商品图片" key="55" style={{ border: '1px solid rgba(223,225,230,1)' }}>
<TabPane tab="商品图片" key="5" style={{ border: '1px solid rgba(223,225,230,1)' }}>
<ProductImageForm />
</TabPane>
<TabPane tab="商品描述" key="66">
<ProductDescForm />
<TabPane tab="商品描述" key="6">
<ProductDescFormOne />
</TabPane>
<TabPane tab="物流信息" key="77">
<TabPane tab="物流信息" key="7">
<LogisticsForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
/>
</TabPane>
<TabPane tab="其他" key="88">
<TabPane tab="其他" key="8">
<OtherForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
/>
......
......@@ -9,7 +9,7 @@ import styles from './index.less'
import { PublicApi } from '@/services/api';
import {
GetProductCustomerGetCustomerCategoryTreeResponse,
GetWarehouseAreaAllResponse
GetManageAreaAllResponse
} from '@/services';
import { inject, observer } from 'mobx-react'
......@@ -63,7 +63,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
const [brandData, setBrandData] = useState<any>([])
const [brandValue, setBrandValue] = useState(undefined)
const [customerCategoryTree, setCustomerCategoryTree] = useState<GetProductCustomerGetCustomerCategoryTreeResponse>()
const [proviceOptions, setProviceOptions] = useState<GetWarehouseAreaAllResponse>()
const [proviceOptions, setProviceOptions] = useState<GetManageAreaAllResponse>()
const [showCategory, setShowCategory] = useState(null)
const [areaParams, setAreaParams] = useState<AreaParams>()
const { ProductStore } = store
......@@ -75,7 +75,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setCustomerCategoryTree(res.data)
})
//获取省市区
PublicApi.getWarehouseAreaAll().then(res => {
PublicApi.getManageAreaAll().then(res => {
if (res.code === 1000) {
let arr = [...res.data] //裁去最后一级别
for (let index in arr) {
......@@ -86,6 +86,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
}
}
setProviceOptions(arr)
ProductStore.setAreaOption(arr)
}
})
//传入ref给父级
......@@ -93,8 +94,9 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
}, [])
const onFinish = (values: any) => {
console.log(values,'原values')
let params = {...values, commodityAreaList: areaParams, customerCategoryId: values?.customerCategoryId.pop()}
console.log('子保单值,', params)
console.log(params, '加工后的values')
}
const handleBrandSearch = (value: any) => { // end value
......@@ -151,7 +153,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
areaParams.cityCode = selected[1].code
}
setAreaParams(areaParams)
console.log(areaParams, 'area')
console.log(value, selected, areaParams, 'area')
}
const onChangeName = (value: any) => {
......@@ -168,6 +170,12 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
colon={false}
ref={basicFormRef}
>
{/* <Form.Item
name="commodityAreaParams"
style={{display:'none'}}
>
<Input disabled />
</Form.Item> */}
<Form.Item
name="customerCategoryId"
label="商品品类"
......@@ -189,6 +197,12 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
<Form.Item
name="brandId"
label="商品品牌"
rules={[
{
required: true,
message: '请选择商品品牌'
}
]}
>
<Select
showSearch
......@@ -279,11 +293,11 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
{...(index === 0 ? layout : layoutFormList)}
label={
field.key === 0 && <span>
<i style={{ color: 'red' }}>* </i>
归属地市&nbsp;
<Tooltip title="设置了归属地市后,此商品可根据地市进行筛选,未设置时默认为所有地市">
<QuestionCircleOutlined />
</Tooltip>
<i style={{ color: 'red' }}> * </i>
</span>
}
rules={[
......@@ -326,14 +340,14 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
>
{showCategory && <><span className="commonStatusValid"></span>{showCategory}</>}
</Form.Item>
<Form.Item {...tailLayout}>
{/* <Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
保存
</Button>
<Button className={styles.ml20}>
取消
</Button>
</Form.Item>
</Form.Item> */}
</Form>
</>)
}
......
import React, { useState, useEffect, useRef } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col } from 'antd'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col, InputNumber } from 'antd'
import { PublicApi } from '@/services/api'
import { GetLogisticsSelectListCompanyResponse, GetLogisticsSelectListShipperAddressResponse } from '@/services'
......@@ -90,7 +90,10 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
rules={[
{
required: true,
message: '请填入重量'
type: 'number',
message: '请填入重量',
min: 0,
transform: (value) => Number(value)
},
]}
>
......
import React, { useState, useEffect, useRef, useContext, useCallback, useMemo } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col } from 'antd'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col, InputNumber } from 'antd'
import styles from './index.less'
import { PublicApi } from '@/services/api'
import { StandardTable } from 'god'
......@@ -75,7 +75,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
constructedCallback()
},[productName, selectedGoods, productSelectAttribute, planPrice])
// 构建表格列和data
/* 构建表格列和data */
const constructedCallback = () => {
console.log(productName,'name')
console.log(333)
......@@ -175,11 +175,16 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
Array.isArray(_rowArr) ? _rowArr.map((__rowArr, index) => {
_tempObj[_attributeNameArr[index]] = __rowArr
}) : _tempObj[_attributeNameArr[i]] = _rowArr
_tempObj['对应货品'] = selectedGoods.length > 0 && selectedGoods[0].id
_tempObj['对应货品'] = selectedGoods.length > 0 ? selectedGoods[0].id : 0
_tempObj['单价'] = {}
_tableData.push(_tempObj)
console.log(_rowArr,'_tempObj')
})
}else{ // length不存在,默认只有商品名称一行
let _tempObj: any = { 索引: 0 ,商品名称: productName }
_tempObj['对应货品'] = selectedGoods.length > 0 ? selectedGoods[0].id : 0
_tempObj['单价'] = {}
_tableData.push(_tempObj)
}
console.log(_tableData, '_tableData')
_tableDataSource = _tableData
......@@ -192,12 +197,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
constructedPrarams()
},[combineAttributeArray, attributeObjArr, attributeValObjArr, setPriceModal, tableDataSource])
// 生成传输数据
/* 生成传输数据 */
const constructedPrarams = () => {
let _paramsArray: any[] = [];
console.log('生成传输数据', combineAttributeArray, attributeObjArr, attributeValObjArr)
Array.isArray(combineAttributeArray) && combineAttributeArray.map((item, index)=>{ // 当属性减少的时候 这个combine数组还是之前的
let _tempArr: any = [], _tempObj: any = {}
console.log('生成传输数据', combineAttributeArray, attributeObjArr, attributeValObjArr, tableDataSource)
Array.isArray(combineAttributeArray) ? combineAttributeArray.map((item, index)=>{ // 非数组情况下默认无组合 从table数据中获取 // 当属性减少的时候 这个combine数组还是之前的
let _tempArr: any = []
Array.isArray(item) ? item.map((_item, _index)=>{
let _tempObject: any = {};
_tempObject.customerAttributeId = attributeObjArr[_index].customerAttributeId
......@@ -211,8 +216,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
customerAttributeValueId: attributeValObjArr[0][0].customerAttributeValueId,
value: item.toString()
})
_paramsArray.push({goodsId: _tableDataSource[index] && _tableDataSource[index]['对应货品'], goodsCustomerAttributeList: _tempArr, unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价']}) /*带上货品id 带上单价*/
})
_paramsArray.push({goodsId: _tableDataSource[index] ? _tableDataSource[index]['对应货品'] : 0, goodsCustomerAttributeList: _tempArr, unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价']}) /*带上货品id 带上单价*/
}) : _paramsArray.push({goodsId: _tableDataSource[0] ? _tableDataSource[0]['对应货品'] : 0, goodsCustomerAttributeList: [], unitPrice: _tableDataSource[0]&&_tableDataSource[0]['单价']}) /*带上货品id 带上单价*/
setPriceAttributeParams(_paramsArray)
console.log(_paramsArray,'params')
}
......@@ -317,8 +322,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
}
const handleUnitChange = (value:any) => {
const handleUnitChange = (value:any, option: any) => {
console.log(value, option,'change value')
setUnitValue(value)
priceForm.setFieldsValue({unitName: option.children})
}
return (<>
......@@ -355,7 +362,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
showArrow={false}
filterOption={false}
onSearch={handleUnitSearch}
onChange={handleUnitChange}
onChange={(value,option)=>handleUnitChange(value, option)}
notFoundContent={null}
style={{width:'100%'}}
>
......@@ -363,6 +370,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</Select>
</Form.Item>
<Form.Item
name="unitName"
style={{display:'none'}}
label="单位名称"
initialValue=""
>
<Input disabled={true} />
</Form.Item>
<Form.Item
name="minOrder"
label={
<span>
......@@ -374,7 +389,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
rules={[{
required: true,
message: '请输入最小起订数'
type: 'number',
message: '请输入最小起订数',
min: 0,
transform: (value) => Number(value)
}]}
>
<Input placeholder="请输入最小起订数" />
......@@ -416,6 +434,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
message: '请选择会员折扣'
}]}
valuePropName="checked"
initialValue={false}
>
<Checkbox>允许使用会员折扣价购买</Checkbox>
</Form.Item>
......
......@@ -47,7 +47,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}, [])
const onFinish = (values) => {
console.log(values)
}
......@@ -167,7 +166,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
form={attributeForm}
name="attribute-form"
labelAlign="left"
onFinish={onFinish}
// onFinish={onFinish}
ref={productAttributeFormRef}
colon={false}
>
......@@ -183,14 +182,14 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
)
}
</Tabs>
<Form.Item {...tailLayout}>
{/* <Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
保存
</Button>
<Button className={styles.ml20}>
取消
</Button>
</Form.Item>
</Form.Item> */}
</Form>
{attributesData?.length === 0 && "请先选择基本信息中商品品类项!"}
</>)
......
import React, { useState, useEffect } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox, Tooltip, Radio, Input, Table, Modal, Row, Col } from 'antd'
import styles from '../index.less'
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons'
export interface Iprops {
}
const ProductDescForm: React.FC<Iprops> = (props) => {
return (<>
<div className={styles.descriptBox}>
<p>文字区域</p>
<div className={styles.bottomBtn}>
<Button icon={<PlusOutlined />}>添加文字</Button>
</div>
</div>
<div className={styles.descriptBox}>
<p>视频区域</p>
<div className={styles.bottomBtn}>
<Button icon={<DeleteOutlined />}>删除</Button>
<Button icon={<PlusOutlined />}>添加素材</Button>
</div>
</div>
<div className={styles.descriptBox}>
<p>图片区域</p>
<div className={styles.bottomBtn}>
<Button icon={<DeleteOutlined />}>删除</Button>
<Button icon={<PlusOutlined />}>添加素材</Button>
</div>
</div>
</>)
}
export default ProductDescForm
\ No newline at end of file
import React, { useState, useEffect } from 'react'
import {history} from 'umi'
import { Button, Form, Select, Checkbox, message, Upload, Input, Table, Modal, Row, Col } from 'antd'
import styles from '../index.less'
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
export interface Iprops {
}
const ProductDescFormOne: React.FC<Iprops> = (props) => {
const [fileImageList, sefileImageList] = useState<any>([
// {
// uid: '-1',
// name: 'image.png',
// status: 'done',
// url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
// },
// {
// uid: '-2',
// name: 'image.png',
// status: 'done',
// url: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
// },
])
useEffect(()=>{
// PublicApi
}, [])
const uploadProps = {
name: 'file',
action: '/imgapi/file/file/upload',
showUploadList: false,
data: { fileType: 2 },
headers: {
authorization: 'authorization-text',
},
onChange(info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList, 'image files');
}
if (info.file.status === 'done') {
message.success(`${info.file.name} 文件上传成功`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败`);
}
},
}
return (<>
<div className={styles.descriptBox}>
<p className={styles.pVideo}>视频区域<br />(数量限一个)</p>
<div className={styles.rightBtn}>
<Button icon={<PlusOutlined />} />
<Button icon={<DeleteOutlined />} />
</div>
</div>
<div className={styles.descriptBox}>
<p>图片区域</p>
<div className={styles.rightBtn}>
<Button icon={<PlusOutlined />} />
<Button icon={<DeleteOutlined />} />
</div>
</div>
<div className={styles.descriptBox}>
<p>图片区域</p>
<div className={styles.rightBtn}>
<Button icon={<PlusOutlined />} />
<Button icon={<DeleteOutlined />} />
</div>
</div>
<div className={styles.descriptBox}>
<p className={styles.middleAddBtn}>
<Upload {...uploadProps}>
<Button type="text">
<PlusOutlined />
</Button>
<br/>
<span>添加图片区域</span>
</Upload>
</p>
</div>
</>)
}
export default ProductDescFormOne
\ No newline at end of file
......@@ -91,17 +91,37 @@
.descript-box{
position: relative;
margin: 24px;
width: 790px;
margin: 24px auto;
border:1px solid rgba(235,236,240,1);
text-align: center;
color:rgba(151,160,175,1);
height: 128px;
.bottom-btn{
p{
height: 128px;
line-height: 128px;
}
.pVideo, .middleAddBtn{
height: 44px;
line-height: 1.5;
position: absolute;
top:50%;
left:50%;
transform: translate(-50%, -50%);
}
.right-btn{
position: absolute;
top: 0;
right: 0;
bottom: 0;
Button{
margin-left: 16px;
display: block;
width:36px;
height:36px;
background:rgba(250,251,252,1);
border-color: #ebecf0;
border-radius: 0px;
border-top: none;
border-right: none;
}
}
}
......
......@@ -157,9 +157,9 @@ const Products: React.FC<{}> = () => {
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (record.status === 3)
component = (<><span className="commonStatusValid"></span>审核通过</>)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusInvalid">审核通过</span></>)
component = (<><span className="commonStatusInvalid">审核通过</span></>)
else if (record.status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 6)
......@@ -176,11 +176,11 @@ const Products: React.FC<{}> = () => {
value: 2,
},
{
text: '审核通过',
text: '审核通过',
value: 3,
},
{
text: '审核通过',
text: '审核通过',
value: 4,
},
{
......@@ -215,9 +215,9 @@ const Products: React.FC<{}> = () => {
<Menu.Item>
{record.status === 1 ? <Button type='link' onClick={()=>clickSubmitCheck(record)}>提交审核</Button> : ''}
</Menu.Item>
{(record.status === 3 || record.status === 6) ? <Menu.Item><Button type='link' onClick={() => clickUp(1)}>上架</Button></Menu.Item> : ''}
{(record.status === 4 || record.status === 6) ? <Menu.Item><Button type='link' onClick={() => clickUp(1)}>上架</Button></Menu.Item> : ''}
{record.status === 5 ? <Menu.Item><Button type='link' onClick={() => clickUp(0)}>下架</Button></Menu.Item> : ''}
{record.status === 4 ? <Menu.Item><Button type='link'>修改</Button></Menu.Item> : ''}
{record.status === 3 ? <Menu.Item><Button type='link'>修改</Button></Menu.Item> : ''}
<Menu.Item>
<Button type='link' onClick={()=>clickCopy(record)}>复制</Button>
</Menu.Item>
......@@ -427,6 +427,8 @@ const Products: React.FC<{}> = () => {
const { id } = record;
if(id)
PublicApi.postProductCommodityApplyCheckCommodity({id: id})
//@ts-ignore
ref.current.reload(restObj)
}
const handleMenuClick = (e: any) => {
......
/*
* @Author: LeeJiancong
* @Date: 2020-07-30 17:23:48
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-30 17:24:49
*/
export default {
default: {
padding: '2px 5px',
background: 'rgba(244,245,247,1)',
borderRadius: '4px'
},
confirm: {
color: '#3F7ED2',
padding: '2px 5px',
background: 'rgba(240, 248, 255, 1)',
borderRadius: '4px'
},
success: {
color: '#00B37A',
padding: '2px 5px',
background: 'rgba(235,247,242,1)',
borderRadius: '4px'
},
warn: {
color: '#E63F3B',
padding: '2px 5px',
background: 'rgba(255,235,230,1)',
borderRadius: '4px'
}
}
\ No newline at end of file
......@@ -7,10 +7,13 @@ import {
} from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components'
import { values } from 'mobx';
import {PublicApi} from '@/services/api'
export interface Params {
dialogVisible: boolean,
onCancel: Function,
dontReceive?: boolean //默认展示
id: number | string;
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
dontReceive?: boolean; //默认展示
}
const actions = createFormActions()
const {onFieldChange$} = FormEffectHooks
......@@ -19,9 +22,15 @@ const comfirmDialog: React.FC<Params> = (props) => {
const handleCancel = () => {
}
const handletOk = (values:any) => {
let value = {...values}
value.id = props.id
console.log(values)
actions.submit()
props.onCancel()
PublicApi.postLogisticsOrderWaitConfirmConfirm(value).then(res => {
if(res.code === 1000){
props.onOK()
}
})
}
useEffect(() => {
return () => {
......@@ -29,9 +38,9 @@ const comfirmDialog: React.FC<Params> = (props) => {
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
onFieldChange$('radio').subscribe(({value}) => {
onFieldChange$('status').subscribe(({value}) => {
setFieldState('remarkOption',state => {
if(value == 1){
if(value == 3){
state.visible = false
}else{
state.visible = true
......@@ -46,7 +55,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
title='单据确认'
width={800}
visible={props.dialogVisible}
onOk={handletOk}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
......@@ -58,28 +67,30 @@ const comfirmDialog: React.FC<Params> = (props) => {
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)
}
onSubmit={(values) => handletOk(values) }
initialValues={{
status: 3
}}
>
<Field
enum={
[
{ label: '接受物流单', value:1 },
{ label: '不接受物流单', value:2 }
{ label: '接受物流单', value:3},
{ label: '不接受物流单', value:4 }
]}
name='radio'
name='status'
required
x-component="Radio"
/>
{props.dontReceive &&
<FormMegaLayout name='remarkOption' label='不接受原因' full required wrapperWidth={570} labelCol={2} labelAlign="top">
<FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top">
<Field
name="remark"
x-component="TextArea"
required
x-component-props={{
placeholder: '在此输入你的内容,最多60个汉字'
}}
x-rules={value => {
......
/*
* @Author: LeeJiancong
* @Date: 2020-07-18 15:55:51
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-31 19:23:51
*/
import React, { useState, useEffect, useRef, ReactNode } from 'react';
import { Card, Button, Row, Col, Tooltip, Input, Select, Tag, Space } from 'antd'
import { UpOutlined, DownOutlined, EyeOutlined } from '@ant-design/icons'
......@@ -9,6 +15,8 @@ import { history } from 'umi'
import { hidden } from 'chalk';
import { PublicApi } from '@/services/api';
import {timeRange} from '@/utils/index'
import statuStyle from '../colorTag'
import moment from 'moment'
let { Option } = Select
export interface listProps {
title?: ReactNode,
......@@ -23,32 +31,6 @@ const data = [
status: 0
}
]
const statuStyle = {
default: {
padding: '2px 5px',
background: 'rgba(244,245,247,1)',
borderRadius: '4px'
},
confirm: {
color: '#3F7ED2',
padding: '2px 5px',
background: 'rgba(240, 248, 255, 1)',
borderRadius: '4px'
},
success: {
color: '#00B37A',
padding: '2px 5px',
background: 'rgba(235,247,242,1)',
borderRadius: '4px'
},
warn: {
color: '#E63F3B',
padding: '2px 5px',
background: 'rgba(255,235,230,1)',
borderRadius: '4px'
}
}
// 定义列的格式
interface Item {
oredrNo: string
......@@ -66,7 +48,7 @@ interface paramsType {
const orderSearchList: React.FC<listProps> = (props) => {
console.log(props)
const ref = useRef({})
const ref = useRef<any>({})
const [selectRow, setSelectRow] = useState<Item[]>([])
const TimeList = [
{
......@@ -174,12 +156,6 @@ const orderSearchList: React.FC<listProps> = (props) => {
* @return:
*/
useEffect(() => {
let timeRanges = timeRange(TimeRange);
setSearchForm({
...searchForm,
invoicesTimeStart: timeRanges.st,
invoicesTimeEnd: timeRanges.et
});
console.log(searchForm)
if(props.type === '1'){
PublicApi.getLogisticsSelectListCompany().then(res => {
......@@ -205,7 +181,14 @@ const orderSearchList: React.FC<listProps> = (props) => {
return () => {
}
}, [])
useEffect(() => {
ref.current.reload()
return () => {
}
}, [TimeRange])
const handleSee = (id: number) => {
if (props.type === '1') {
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil?id=${id}`)
......@@ -267,7 +250,8 @@ const orderSearchList: React.FC<listProps> = (props) => {
title: '单据时间',
align: 'left',
dataIndex: 'invoicesTime',
key: 'invoicesTime'
key: 'invoicesTime',
render: (text:any) => <>{moment(text).format('YYYY-MM-DD HH:mm:ss')}</>
},
{
title: '外部状态',
......@@ -313,9 +297,15 @@ const orderSearchList: React.FC<listProps> = (props) => {
* @param {type}
* @return:
*/
const handleChange = (key:any,val) => {
const handleChange = (key:any,val:any) => {
let obj = {}
switch(key){
case 'logisticsOrderNo':
obj = { ...searchForm, logisticsOrderNo: val }
break;
case 'invoicesNo':
obj = { ...searchForm, invoicesNo: val }
break;
case 'companyId':
obj = { ...searchForm, companyId: val }
break;
......@@ -331,19 +321,36 @@ const orderSearchList: React.FC<listProps> = (props) => {
ref.current.reload(obj)
}
const handleChangeTime = (val:number) =>{
console.log('选择箱时间',val)
setTimeRange(val)
let timeRanges = timeRange(TimeRange)
console.log('时间范围',timeRanges)
setSearchForm({
...searchForm,
invoicesTimeStart: timeRanges.st,
invoicesTimeEnd: timeRanges.et
});
const changeTimeRange = (val:any) => {
console.log(val)
setTimeRange(val)
let timeRanges = timeRange(val)
console.log('更新',val)
console.log('选项:',val,'时间:',timeRanges)
// setSearchForm({
// ...searchForm,
// invoicesTimeStart: timeRanges.st,
// invoicesTimeEnd: timeRanges.et
// });
searchForm.invoicesTimeStart = timeRanges.st
searchForm.invoicesTimeEnd = timeRanges.et
ref.current.reload();
}
// const handleChangeTime = (val:number) =>{
// console.log('选择箱时间',val)
// setTimeRange(val)
// let timeRanges = timeRange(TimeRange)
// console.log('时间范围',timeRanges)
// setSearchForm({
// ...searchForm,
// invoicesTimeStart: timeRanges.st,
// invoicesTimeEnd: timeRanges.et
// });
// ref.current.reload();
// }
const handleReset = () => {
for (let key in searchForm) {
searchForm[key] = ''
......@@ -355,10 +362,11 @@ const orderSearchList: React.FC<listProps> = (props) => {
<PageHeaderWrapper title='快递单查询'>
<Card>
<StandardTable
tableProps={{rowKey:'id'}}
columns={columns}
currentRef={ref}
formAlign='left'
rowSelection={rowSelection}
// rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)}
rowClassName="editable-row"
controlRender={
......@@ -372,7 +380,7 @@ const orderSearchList: React.FC<listProps> = (props) => {
value={searchForm.logisticsOrderNo}
placeholder='搜索'
onChange={(e) => setSearchForm({ ...searchForm, logisticsOrderNo: e.target.value })}
onSearch={(val) => handleSearch(val)}
onSearch={(val) => handleChange('logisticsOrderNo',val)}
/>
</Tooltip>
<Button className={style['filter-btn']} onClick={() => setIsSearch(isSearch = !isSearch)}>
......@@ -386,8 +394,17 @@ const orderSearchList: React.FC<listProps> = (props) => {
isSearch &&
<Col>
<Space size={16}>
{
props.type === '1' ?
<>
<Input.Search
style={{ width: '232px' }}
value={searchForm.invoicesNo}
placeholder='输入对应单号进行搜索'
onChange={(e) => setSearchForm({ ...searchForm, invoicesNo: e.target.value })}
onSearch={(val) => handleChange('invoicesNo',val)}
/>
<Select
className={style.select}
showSearch
......@@ -406,6 +423,7 @@ const orderSearchList: React.FC<listProps> = (props) => {
})
}
</Select>
</>
:
<Select
className={style.select}
......@@ -419,8 +437,8 @@ const orderSearchList: React.FC<listProps> = (props) => {
>
<Option value=''>发货方(全部)</Option>
{
shipperAddressList.map((item) => {
return <Option value={item.value}>{item.label}</Option>
shipperAddressList.map((item,index) => {
return <Option key={index} value={item.value}>{item.label}</Option>
})
}
</Select>
......@@ -429,11 +447,21 @@ const orderSearchList: React.FC<listProps> = (props) => {
<Select
className={style.select}
value={TimeRange}
onChange={(val) => handleChangeTime(val)}
onChange={(val) =>{
setTimeRange(val),
setSearchForm({
...searchForm,
invoicesTimeStart: timeRange(val).st,
invoicesTimeEnd: timeRange(val).et
})
}
}
>
{
TimeList.map((item) => {
return <Option value={item.value}>{item.label}</Option>
TimeList.map((item,index) => {
return <Option key={index} value={item.value}>{item.label}</Option>
})
}
</Select>
......@@ -443,8 +471,8 @@ const orderSearchList: React.FC<listProps> = (props) => {
onChange={(val) => handleChange('status',val)}
>
{
outSideStatusList.map((item) => {
return <Option value={item.value}>{item.label}</Option>
outSideStatusList.map((item,index) => {
return <Option key={index} value={item.value}>{item.label}</Option>
})
}
</Select>
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-28 14:01:19
* @LastEditTime: 2020-07-30 19:37:57
*/
import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom'
......@@ -31,6 +31,7 @@ import {
import {PublicApi} from '@/services/api'
import styles from './templateForm.less';
import ReutrnEle from '@/components/ReturnEle'
import {PATTERN_MAPS} from '@/constants/regExp'
import ChinaImg from '../../../../../mockStatic/china.png'
import gou from '../../../../../mockStatic/gou.png'
import japenImg from '../../../../../mockStatic/japen.png'
......@@ -232,7 +233,6 @@ const diaLogForm: React.FC<ListProps> = (props) => {
}}
x-component="Input"
x-component-props={{
placeholder: '',
addonAfter: "KG"
}}
......@@ -240,6 +240,10 @@ const diaLogForm: React.FC<ListProps> = (props) => {
addonBefore: ' ',
addonAfter: '内,'
}}
x-rules={{
pattern: PATTERN_MAPS.weight,
message:'数字类型,可保留3位小数'
}}
/>
<Field
name="price"
......@@ -255,6 +259,10 @@ const diaLogForm: React.FC<ListProps> = (props) => {
placeholder: '',
addonAfter: "元"
}}
x-rules={{
pattern: PATTERN_MAPS.money,
message:'数字类型,可保留2位小数'
}}
/>
</FormMegaLayout>
<FormMegaLayout inline>
......@@ -276,6 +284,10 @@ const diaLogForm: React.FC<ListProps> = (props) => {
addonBefore: '每增加',
addonAfter: '增加运费'
}}
x-rules={{
pattern: PATTERN_MAPS.weight,
message:'数字类型,可保留3位小数'
}}
/>
<Field
name="incrementPrice"
......@@ -291,6 +303,10 @@ const diaLogForm: React.FC<ListProps> = (props) => {
addonAfter: "元"
}}
x-rules={{
pattern: PATTERN_MAPS.money,
message:'数字类型,可保留2位小数'
}}
/>
</FormMegaLayout>
</FormMegaLayout>
......@@ -354,21 +370,42 @@ const diaLogForm: React.FC<ListProps> = (props) => {
console.log(e.target.value)
// actions.validate()
},
// validate: (value:any) => {
// return new Promise(resolve => {
// setTimeout(() => {
// resolve(value !== '57350' ? '验证码验证失败' : '123')
// }, 1000)
// })
// }
}}
x-rules={{
pattern: PATTERN_MAPS.weight,
message:'数字类型,可保留3位小数'
}}
/>
<Field
name="price"
x-component="Input"
type="number"
title="首费(元)"
x-rules={{
pattern: PATTERN_MAPS.money,
message:'数字类型,可保留2位小数'
}}
/>
<Field
name="incrementWeight"
x-component="Input"
type="number"
title="续件(件/KG)"
x-rules={{
pattern: PATTERN_MAPS.weight,
message:'数字类型,可保留3位小数'
}}
/>
<Field
name="incrementPrice"
x-component="Input"
type="number"
title="续费(元)"
x-rules={{
pattern: PATTERN_MAPS.money,
message:'数字类型,可保留2位小数'
}}
/>
<Field name="price" x-component="Input" type="number" title="首费(元)" />
<Field name="incrementWeight" x-component="Input" type="number" title="续件(件/KG)" />
<Field name="incrementPrice" x-component="Input" type="number" title="续费(元)" />
</Field>
</Field>
</Col>
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-07-28 11:25:30
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-29 17:08:32
* @LastEditTime: 2020-07-30 17:37:44
*/
import React, { Component, useEffect, useRef, useState } from 'react'
import { Card, Row, Col, Tabs, Button, Input as SelectInput, Badge } from 'antd'
......@@ -233,7 +233,7 @@ const Deatail: React.FC<{}> = () => {
*/
useEffect(() => {
PublicApi.postLogisticsCompanyList().then(res => {
PublicApi.getLogisticsSelectListCompany().then(res => {
let list = []
res.data.forEach(item => {
list.push({value:item.id,label:item.name})
......@@ -241,7 +241,7 @@ const Deatail: React.FC<{}> = () => {
setCompanyList(list)
})
PublicApi.postLogisticsShipperAddressList().then(res => {
PublicApi.getLogisticsSelectListShipperAddress().then(res => {
let list = []
res.data.forEach(item => {
list.push({value:item.id,label:item.fullAddress})
......
......@@ -14,6 +14,11 @@ import { StandardTable } from 'god'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController';
import ReutrnEle from '@/components/ReturnEle';
import styles from './index.less'
import NiceForm from '@/components/NiceForm'
import { repositDetailSchema } from './schema'
import { createFormActions } from '@formily/antd'
import EyePreview from '@/components/EyePreview'
import { findItemAndDelete } from '@/utils'
const {Item}:any = Form
const { Option } = Select
......@@ -92,6 +97,8 @@ const fetchData = (params:any) => {
})
}
const addSchemaAction = createFormActions()
const AddRepository:React.FC<{}> = (props) => {
const ref = useRef({})
const [form] = Form.useForm()
......@@ -274,16 +281,55 @@ const AddRepository:React.FC<{}> = (props) => {
}
const onNumberChange = (v: any) => {
console.log(v)
setInputSliderValue(v)
}
const handleSubmit = (values) => {
console.log(values)
}
const handleDeleteTable = (id) => {
const value = addSchemaAction.getFieldValue('applyMember')
addSchemaAction.setFieldValue('applyMember', findItemAndDelete(value, id))
}
const tableColumns = [
{ dataIndex: 'id', title: 'ID' },
{ dataIndex: 'name', title: '会员名称', render: (_, record) => <EyePreview url={`/memberCenter/memberAbility/manage/addMember?id=${record.id}&preview=1`}/> },
{ dataIndex: 'type', title: '会员类型' },
{ dataIndex: 'ctl', title: '操作', render: (_, record) => <Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button> }
]
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title="新建仓位"
extra={[
<Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
保存
</Button>,
]}
>
<Card className=''>
<NiceForm
expressionScope={{
tableColumns
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={repositDetailSchema}
/>
</Card>
</PageHeaderWrapper>
)
return (<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title="新建仓位"
extra={[
<Button key="1" type="primary" icon={<SaveOutlined />}>
<Button key="1" onClick={handleSubmit} type="primary" icon={<SaveOutlined />}>
保存
</Button>,
]}
......
import React, { ReactNode, useRef } from 'react'
import React, { ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
import { Button, Popconfirm, Card } from 'antd'
import { Button, Popconfirm, Card, Row, Col, Dropdown, Input, Select, Space } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
PlayCircleOutlined,
EyeOutlined,
DownOutlined,
CaretUpOutlined,
CaretDownOutlined,
} from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController'
import EyePreview from '@/components/EyePreview'
import StatusSwitch from '@/components/StatusSwitch'
import NiceForm from '@/components/NiceForm'
import { createFormActions, FormEffectHooks } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { repositSchema } from './schema'
import { PublicApi } from '@/services/api'
const data = [
{
key: '1',
reposName: '进口头层黄牛皮荔枝纹/红色/XL-渠道商城-所有渠道',
producName: '进口头层黄牛皮荔枝纹/红色/XL',
pType: '牛皮',
brand: '天梭',
unit: '吨',
amount: '15151',
status: 1,
},
{
key: '2',
reposName: '进口头层黄牛皮荔枝纹/红色/XL-渠道商城-所有渠道',
producName: '进口头层黄牛皮荔枝纹/红色/XL',
pType: '牛皮',
brand: '卡帝乐',
unit: '吨',
amount: '15151',
status: 0,
},
]
const formActions = createFormActions()
// 模拟请求
const fetchData = (params:any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords)
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data
})
}, 1000)
})
const fetchData = async (params:any) => {
const res = await PublicApi.getWarehouseFreightSpaceList(params)
return res.data
}
const Repositories: React.FC<{}> = () => {
const ref = useRef({})
const ref = useRef<any>({})
const columns: ColumnType<any>[] = [
{
......@@ -63,7 +45,7 @@ const Repositories: React.FC<{}> = () => {
dataIndex: 'reposName',
align: 'center',
key: 'reposName',
render: (text:any, record:any) => <span className="commonPickColor" onClick={()=>handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
render: (text:any, record:any) => <EyePreview url={`/repositories/viewRepository?id=${record.key}&preview=1`}>{text}</EyePreview>
},
{
title: '商品名称',
......@@ -100,21 +82,7 @@ const Repositories: React.FC<{}> = () => {
align: 'center',
dataIndex: 'status',
key: 'status',
render: (text: any, record:any) => {
let component: ReactNode = null
component = (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={confirm}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type="link" onClick={()=>handleModify(record)} style={record.status===1?{color:'#00B37A'}:{color:'red'}}>{record.status===1?'有效':'无效'} <PlayCircleOutlined /></Button>
</Popconfirm>
)
return component
}
render: (text: any, record:any) => <StatusSwitch handleConfirm={()=>handleModify(record)} record={record}/>
},
{
title: '操作',
......@@ -124,7 +92,7 @@ const Repositories: React.FC<{}> = () => {
return (
<>
{
record.status === 1 ? <Button type='link' onClick={()=>handleAdjust(record)}>库存调拨</Button> : ''
record.state === 1 ? <Button type='link' onClick={()=>handleAdjust(record)}>库存调拨</Button> : ''
}
</>
)
......@@ -132,75 +100,6 @@ const Repositories: React.FC<{}> = () => {
}
];
const search: IFormFilter[] = [
{
type: 'Input',
value: 'keywords',
col: 4,
placeHolder: '商品ID'
},
{
type: 'Input',
value: 'name',
col: 4,
placeHolder: '商品名称'
},
{
type: 'Input',
value: 'brand',
col: 4,
placeHolder: '商品品牌'
},
{
type: 'Input',
value: 'type',
col: 4,
placeHolder: '商品品类'
},
{
type: 'Input',
value: 'repository',
col: 4,
placeHolder: '仓位名称'
},
{
type: 'Select',
value: 'status',
col: 4,
placeHolder: '仓位状态',
statusList: [{
type: 'Select',
label:'所有',
value:'0'
},{
type: 'Select',
label:'还不错',
value:'1'
},{
type: 'Select',
label:'还可以',
value:'2'
}]
},
]
const searchBarActions: IButtonFilter[] = [
{
text: '查询',
handler: () => {
console.log('查询')
}
},
{
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: ()=>{
history.push('/repositories/addRepository')
}
}
]
const handleSee = (record:any) => {
console.log('see')
history.push(`/repositories/viewRepository?id=${record.key}`)
......@@ -210,10 +109,6 @@ const Repositories: React.FC<{}> = () => {
console.log('confirm')
}
const cancel = () => {
console.log('cancel')
}
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record)
......@@ -223,15 +118,37 @@ const Repositories: React.FC<{}> = () => {
history.push(`/memberCenter/commodityAbility/repositories/adjustRepository?id=${record.key}`)
}
const handleToAdd = () => {
history.push(`/memberCenter/commodityAbility/repositories/addRepository`)
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params:any) => fetchData(params)}
formFilters={search}
buttonFilters={searchBarActions}
tableProps={{rowKey: "key"}}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row justify='space-between'>
<Col>
<Space>
<Button type='primary' onClick={handleToAdd} icon={<PlusOutlined />}>新建</Button>
</Space>
</Col>
<Col>
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'search', FORM_FILTER_PATH)
}}
schema={repositSchema}
/>
</Col>
</Row>
}
/>
</Card>
</PageHeaderWrapper>
......
import React from 'react'
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
import { Button } from 'antd';
export const repositSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
"x-component": 'mega-layout',
properties: {
search: {
type: 'string',
"x-component": 'Search',
"x-mega-props": {
},
"x-component-props": {
placeholder: '请输入仓位名称'
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "mega-layout",
visible: false,
"x-component-props": {
inline: true
},
properties: {
productName: {
type: 'string',
"x-component-props": {
placeholder: '商品名称'
}
},
productId: {
type: 'string',
"x-component-props": {
placeholder: '商品ID'
}
},
category: {
type: 'string',
"x-component-props": {
placeholder: '请选择品类'
},
enum: []
},
brand: {
type: 'string',
"x-component-props": {
placeholder: '请选择品牌'
},
enum: []
},
submit: {
"x-component": 'Submit',
"x-component-props": {
children: '查询'
}
}
},
},
}
}
}
}
export const repositDetailSchema: ISchema = {
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: 8,
labelAlign: 'left'
},
properties: {
name: {
type: 'string',
required: true,
title: '仓位名称',
"x-component-props": {
placeholder: '建议名称:商品名称+商城名称+渠道描述'
}
},
productName: {
type: 'string',
title: '商品名称',
required: true
},
warehouseId: {
type: 'string',
title: '仓库名称',
enum: []
},
itemNo: {
type: 'string',
"x-component": 'Text',
title: '对应货品',
default: '暂无'
},
inventory: {
type: 'number',
"x-component": "CustomSlider",
required: true,
"x-component-props": {
min: 0,
max: 200
},
title: '分配仓位库存',
},
inventoryDeductWay: {
type: 'radio',
title: '库存扣减方式',
required: true,
enum: [
{
label: '按仓位随机扣减',
value: 1
},
{
label: '按仓库位置远近扣除',
value: 2
}
],
default: 1
}
}
}
}
},
"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: {
"shopIds": {
"type": "array:number",
"x-component": 'CardCheckBox',
"x-component-props": {
dataSource: [
{ logo: '', title: '会员', id: 1 },
{ logo: '', title: '小程序', id: 2 },
{ logo: '', title: 'H5', id: 3 },
{ logo: '', title: '渠道', id: 4 },
]
},
"title": "适用商城",
required: true,
}
}
}
}
},
"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: {
"isAllMemberShare": {
"type": "radio",
enum: [
{ label: '所有会员共享(默认)', value: 1 },
{ label: '指定会员', value: 0 },
],
"title": "选择渠道会员",
default: 1,
required: true,
},
applyMember: {
type: 'array:number',
"x-component": 'MultTable',
"x-component-props": {
columns: "{{tableColumns}}"
},
default: [
{ id: 1, name: '名称', type: '类型' },
{ id: 2, name: '名称1', type: '类型1' }
]
}
}
}
}
}
}
}
}
}
import React, { useState, useEffect, useRef } from 'react';
import { history } from 'umi';
import {
Tooltip,
Input,
Select,
Button,
Card,
Dropdown,
Menu,
Row,
Col,
Popconfirm,
} from 'antd';
import {
PlusOutlined,
EyeOutlined,
UpOutlined,
DeleteOutlined,
DownOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import style from './index.less';
const Bills: React.FC<{}> = () => {
return <div>Bills</div>;
};
export default Bills;
import React, { useState, useEffect, useRef } from 'react';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Tooltip, Input, Button, Card, Row, Col, Popconfirm } from 'antd';
import {
PlusOutlined,
EyeOutlined,
PlayCircleOutlined,
PauseCircleOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import style from './index.less';
const data = [
{
key: '1',
id: '1',
no: 'DJ001',
name: '进货入库单',
direction: 1,
status: 1,
},
{
key: '2',
id: '2',
no: 'DJ002',
name: '退货入库单',
direction: 2,
status: 2,
},
];
const billsType: React.FC<{}> = () => {
const ref = useRef({});
const [searchName, setSearchName] = useState('');
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '单据类型编号',
dataIndex: 'no',
align: 'center',
key: 'no',
},
{
title: '单据名称',
dataIndex: 'name',
align: 'center',
key: 'name',
render: (text: any, record: any) => {
return (
<span className="commonPickColor" onClick={() => history.push('')}>
{text}&nbsp;
<EyeOutlined />
</span>
);
},
},
{
title: '方向',
dataIndex: 'direction',
align: 'center',
key: 'direction',
render: (text: any, record: any) => {
return (
<span>
{text}
{record.direction === 1 ? ' +' : ' -'}
</span>
);
},
},
{
title: '状态',
dataIndex: 'status',
align: 'center',
key: 'status',
sorter: true,
render: (text: any, record: any) => {
return (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => console.log('...')}
onCancel={() => console.log('...')}
okText="是"
cancelText="否"
>
<Button
type="link"
onClick={() => console.log('???')}
style={
record.status === 1 ? { color: '#00B37A' } : { color: 'red' }
}
>
{record.status === 1 ? (
<>
有效 <PlayCircleOutlined />
</>
) : (
<>
无效 <PauseCircleOutlined />
</>
)}
</Button>
</Popconfirm>
);
},
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (record: any) => (
<>
<Button type="link" onClick={record => history.push('')}>
编辑
</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => console.log('...')}
onCancel={() => console.log('...')}
okText="是"
cancelText="否"
>
<Button type="link">删除</Button>
</Popconfirm>
</>
),
},
];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords);
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data,
});
}, 1000);
});
};
const handleReset = () => {};
return (
<PageHeaderWrapper>
<Card>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row>
<Col span={12}>
<Button
type="primary"
onClick={() =>
history.push(
'/memberCenter/memberAbility/manage/addMember?type=add',
)
}
>
<PlusOutlined />
新建
</Button>
</Col>
<Col span={12} style={{ textAlign: 'right' }}>
<Tooltip
trigger={['focus']}
placement="top"
title={<span>输入单据名称进行搜索</span>}
>
<Input.Search
style={{ width: '232px' }}
value={searchName}
placeholder="搜索"
onChange={e => setSearchName(e.target.value)}
/>
</Tooltip>
<Button
style={{ marginLeft: '16px' }}
onClick={() => handleReset()}
>
重置
</Button>
</Col>
</Row>
}
/>
</Card>
</PageHeaderWrapper>
);
};
export default billsType;
import React, { useState, useEffect, useRef } from 'react';
import { history } from 'umi';
import {
Tooltip,
Input,
Select,
Button,
Card,
Dropdown,
Menu,
Row,
Col,
Popconfirm,
} from 'antd';
import {
PlusOutlined,
EyeOutlined,
UpOutlined,
DeleteOutlined,
DownOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import style from './index.less';
const Inventory: React.FC<{}> = () => {
return <div>Inventory</div>;
};
export default Inventory;
import React, { useState, useEffect, useRef } from 'react';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Tooltip, Input, Button, Card, Row, Col, Popconfirm } from 'antd';
import {
PlusOutlined,
EyeOutlined,
PlayCircleOutlined,
PauseCircleOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import style from './index.less';
const data = [
{
key: '1',
id: '1',
name: '广州成品仓',
address: '广东省广州市海珠区新港东路1068号中洲中心北塔6楼',
person: '蒯美政',
phoneMobile: '185 2929 5432',
status: 1,
},
{
key: '2',
id: '2',
name: '广州成品仓',
address: '广东省广州市海珠区新港东路1068号中洲中心北塔6楼',
person: '蒯美政',
phoneMobile: '185 2929 5432',
status: 2,
},
];
const WareHouse: React.FC<{}> = () => {
const ref = useRef({});
const [searchName, setSearchName] = useState('');
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '仓库名称',
dataIndex: 'name',
align: 'center',
key: 'name',
render: (text: any, record: any) => {
return (
<span className="commonPickColor" onClick={() => history.push('')}>
{text}&nbsp;
<EyeOutlined />
</span>
);
},
},
{
title: '仓库地址',
dataIndex: 'address',
align: 'center',
key: 'address',
},
{
title: '仓库负责人',
dataIndex: 'person',
align: 'center',
key: 'person',
},
{
title: '联系电话',
dataIndex: 'phoneMobile',
align: 'center',
key: 'phoneMobile',
},
{
title: '状态',
dataIndex: 'status',
align: 'center',
key: 'status',
sorter: true,
render: (text: any, record: any) => {
return (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => console.log('...')}
onCancel={() => console.log('...')}
okText="是"
cancelText="否"
>
<Button
type="link"
onClick={() => console.log('???')}
style={
record.status === 1 ? { color: '#00B37A' } : { color: 'red' }
}
>
{record.status === 1 ? (
<>
有效 <PlayCircleOutlined />
</>
) : (
<>
无效 <PauseCircleOutlined />
</>
)}
</Button>
</Popconfirm>
);
},
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (record: any) => (
<>
<Button type="link" onClick={record => history.push('')}>
编辑
</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => console.log('...')}
onCancel={() => console.log('...')}
okText="是"
cancelText="否"
>
<Button type="link">删除</Button>
</Popconfirm>
</>
),
},
];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords);
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data,
});
}, 1000);
});
};
const handleReset = () => {};
return (
<PageHeaderWrapper>
<Card>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row>
<Col span={12}>
<Button
type="primary"
onClick={() =>
history.push(
'/memberCenter/memberAbility/manage/addMember?type=add',
)
}
>
<PlusOutlined />
新建
</Button>
</Col>
<Col span={12} style={{ textAlign: 'right' }}>
<Tooltip
trigger={['focus']}
placement="top"
title={<span>输入仓库名称进行搜索</span>}
>
<Input.Search
style={{ width: '232px' }}
value={searchName}
placeholder="搜索"
onChange={e => setSearchName(e.target.value)}
/>
</Tooltip>
<Button
style={{ marginLeft: '16px' }}
onClick={() => handleReset()}
>
重置
</Button>
</Col>
</Row>
}
/>
</Card>
</PageHeaderWrapper>
);
};
export default WareHouse;
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,6 +9,8 @@ class ProductStore implements IProductModule {
@observable public selectedGoods: GetProductGoodsGetGoodsListResponseDetail[] = [];
@observable public tableDataSource: any[] = [];
@observable public priceAttributeParams: any[] = [];
@observable public productAttributeAndImageParams: any[] = [];
@observable public areaOption: any[] = [];
/** 定义动作区块,外部调用,改变对应的状态 **/
// 可以改变存的testText值
......@@ -47,6 +49,16 @@ class ProductStore implements IProductModule {
public setPriceAttributeParams<T>(datas: T[]) {
this.priceAttributeParams = datas
}
@action.bound
public setProductAttributeAndImageParams(datas: any[]) {
this.productAttributeAndImageParams = datas
}
@action.bound
public setAreaOption(datas: any[]) {
this.areaOption = datas
}
}
......
import {action, computed, observable, runInAction} from 'mobx'
import { ISiteModule } from '@/module/siteModule';
class SiteStore implements ISiteModule {
@observable public siteId: number = 255;
}
export default SiteStore
import { createFormActions, FormPath } from '@formily/antd'
export const useLinkageUtils = () => {
const { setFieldState } = createFormActions()
const linkage = (key, defaultValue?) => (path, value?) =>
setFieldState(path, state => {
FormPath.setIn(state, key, value !== undefined ? value : defaultValue)
})
return {
hide: linkage('visible', false),
show: linkage('visible', true),
visible: linkage('visible'),
enum: linkage('props.enum', []),
loading: linkage('loading', true),
loaded: linkage('loading', false),
value: linkage('value')
}
}
......@@ -112,6 +112,20 @@ export function omit(obj: any, arr: string[]) {
return tempObj
}
export const findItemAndDelete = (arr: any[], target) => {
const newArr = [...arr]
if (newArr.length > 0 && isObject(newArr[0])) {
return newArr.filter(v => v.id !== target)
}
const targetIndex = arr.indexOf(target)
if (targetIndex === -1) {
return newArr
} else {
newArr.splice(targetIndex, 1)
return newArr
}
}
export default {
isArray,
isObject,
......
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