Commit d2166fb0 authored by 前端-许佳敏's avatar 前端-许佳敏
parents 0caf966a e4def9b4
......@@ -134,7 +134,7 @@ const AddGoods = () => {
message: '请填入货号'
},
{
pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*-_])[\da-zA-Z~!@#$%^&*-_]{1,20}$/,
pattern: /^(?=.*\d)(?=.*[a-z_A-Z])(?=.*[~!@#$%^&*-_])[\da-zA-Z~!@#$%^&*-_]{1,20}$/,
message: '最长20个字符(由字母、数组、特殊字符组成)'
}
]}
......@@ -260,6 +260,10 @@ const AddGoods = () => {
{
required: true,
message: '请填入成本价',
},
{
pattern: /^\d+(\.\d{1,4})?$/,
message: '小数点后仅限四位',
}
]}
>
......
import React, { useState, useEffect, useRef } from 'react'
import { history } from 'umi'
import { Button, Form, Card, Modal, Result, Progress, Select, Dropdown, Menu, Row, Col, Input, Popconfirm, message } from 'antd'
import { Button, Form, Space, Card, Modal, Result, Progress, Select, Dropdown, Menu, Row, Col, Input, Popconfirm, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
......@@ -16,6 +16,13 @@ import { ColumnType } from 'antd/lib/table/interface'
import styles from "./index.less"
import { PublicApi } from '@/services/api'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import NiceForm from '@/components/NiceForm'
import { createFormActions, FormEffectHooks } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { goodsSchema } from './schema'
import { FORM_FILTER_PATH } from '@/formSchema/const'
const { Option } = Select;
......@@ -41,8 +48,10 @@ interface paramItem {
batch: string;
}
const formActions = createFormActions();
const Goods: React.FC<{}> = () => {
const ref = useRef({})
const ref = useRef<any>({})
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])
const [importModal, setImportModal] = useState(false)
......@@ -116,7 +125,7 @@ const Goods: React.FC<{}> = () => {
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handleSingleDelete(record)}
onCancel={()=>console.log('取消')}
onCancel={() => console.log('取消')}
okText="是"
cancelText="否"
>
......@@ -131,16 +140,16 @@ const Goods: React.FC<{}> = () => {
const fetchData = (params: any) => {
console.log(params)
return new Promise((resolve, reject) => {
let obj = {...params}
PublicApi.getProductGoodsGetGoodsList(obj).then(res=>{
let obj = { ...params }
PublicApi.getProductGoodsGetGoodsList(obj).then(res => {
resolve(res.data)
})
})
}
const handleSingleDelete = (record:any) => {
if(record?.id)
PublicApi.postProductGoodsDeleteBatchGoods({idList: [record.id]}).then(res=>{
const handleSingleDelete = (record: any) => {
if (record?.id)
PublicApi.postProductGoodsDeleteBatchGoods({ idList: [record.id] }).then(res => {
//@ts-ignore
ref.current.reload()
})
......@@ -284,12 +293,12 @@ const Goods: React.FC<{}> = () => {
const handleMenuClick = (e: any) => {
// console.log('menu', e, selectedRowKeys); // 1 批量删除;2 删除导入批次
if(e.key === '1'){
PublicApi.postProductGoodsDeleteBatchGoods({idList: goodsRowCtl.selectedRowKeys}).then(res=>{
if (e.key === '1') {
PublicApi.postProductGoodsDeleteBatchGoods({ idList: goodsRowCtl.selectedRowKeys }).then(res => {
//@ts-ignore
ref.current.reload()
})
}else if(e.key === '2'){
} else if (e.key === '2') {
console.log('删除导入批次')
setDeleteBatchModal(true)
}
......@@ -307,7 +316,7 @@ const Goods: React.FC<{}> = () => {
const handleSearch = (val: string) => {
console.log(val)
let obj = {...filterParams, name: val}
let obj = { ...filterParams, name: val }
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
......@@ -322,17 +331,17 @@ const Goods: React.FC<{}> = () => {
ref.current.reload(restObj)
}
const nameChange = (e:any) => {
const nameChange = (e: any) => {
console.log(e.target.value)
let obj = {...filterParams, name: e.target.value}
let obj = { ...filterParams, name: e.target.value }
setFilterParams(obj)
}
const handleBrandSearch = (value:any) => { // end value
const handleBrandSearch = (value: any) => { // end value
console.log(value, 'handleBrandSearch')
if (value) {
PublicApi.getProductSelectGetSelectBrand({name: value}).then(res=>{
if(res.code === 1000)
PublicApi.getProductSelectGetSelectBrand({ name: value }).then(res => {
if (res.code === 1000)
setBrandData(res.data)
})
} else {
......@@ -340,18 +349,18 @@ const Goods: React.FC<{}> = () => {
}
}
const handleBrandChange = (value:any) => {
const handleBrandChange = (value: any) => {
setBrandValue(value)
console.log(value, 'handleBrandChange')
let obj = {...filterParams, brandId: value}
let obj = { ...filterParams, brandId: value }
setFilterParams(obj)
}
const handleClassSearch = (value:any) => {
const handleClassSearch = (value: any) => {
console.log(value, 'handleClassSearch')
if (value) {
PublicApi.getProductSelectGetSelectCustomerCategory({name: value}).then(res=>{
if(res.code === 1000)
PublicApi.getProductSelectGetSelectCustomerCategory({ name: value }).then(res => {
if (res.code === 1000)
setClassData(res.data)
})
} else {
......@@ -359,13 +368,30 @@ const Goods: React.FC<{}> = () => {
}
}
const handleClassChange = (value:any) => {
const handleClassChange = (value: any) => {
setClassValue(value)
let obj = {...filterParams, customerCategoryId: value}
let obj = { ...filterParams, customerCategoryId: value }
setFilterParams(obj)
console.log(value, 'handleClassChange')
}
const controllerBtns = (
<Space>
<Button
type='primary'
onClick={() => history.push('/memberCenter/commodityAbility/commodity/goods/addGoods')}
>
<PlusOutlined />新建
</Button>
<Button style={{ margin: '0 16px' }} onClick={() => setImportModal(true)}>导入数据</Button>
<Dropdown overlay={menuMore} trigger={['click']}>
<Button>
更多 <DownOutlined />
</Button>
</Dropdown>
</Space>
);
return (
<PageHeaderWrapper>
<Card>
......@@ -373,7 +399,7 @@ const Goods: React.FC<{}> = () => {
columns={columns}
currentRef={ref}
rowSelection={goodsRowSelection}
tableProps={{rowKey: "id"}}
tableProps={{ rowKey: "id" }}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row>
......
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const goodsSchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '货品名称',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
code: {
type: 'string',
'x-component-props': {
placeholder: '货号'
},
},
brandId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '品牌',
showSearch: true,
showArrow: true,
filterOption: false,
defaultActiveFirstOption: false,
notFoundContent: false,
style: { width: '100%' },
},
},
customerCategoryId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '品类',
style: { width: '100%' }
},
},
batch: {
type: 'string',
'x-component-props': {
placeholder: '导入批次'
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
\ No newline at end of file
......@@ -300,29 +300,29 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
<Tooltip title="设置了归属地市后,此商品可根据地市进行筛选,未设置时默认为所有地市">
<QuestionCircleOutlined />
</Tooltip>
<i style={{ color: 'red' }}> * </i>
</span>
}
rules={[
{
required: true,
message: '请选择地区'
}
]}
// rules={[
// {
// required: true,
// message: '请选择地区'
// }
// ]}
key={field.key}
>
<Form.Item
{...field}
rules={[
{
required: true,
message: "请选择地区",
},
]}
// rules={[
// {
// required: true,
// message: "请选择地区",
// },
// ]}
noStyle
>
<Cascader
options={proviceOptions}
changeOnSelect
onChange={onCommodityAreaChange}
placeholder="请选择地区"
fieldNames={{ label: 'name', value: 'code', children: 'areaResponses' }}
......
......@@ -37,8 +37,8 @@ interface paramItem {
name: string;
code: string;
priceType: number;
Min: number;
Max: number;
min: number;
max: number;
brandId: number;
customerCategoryId: number;
status: number;
......@@ -65,8 +65,8 @@ const Products: React.FC<{}> = () => {
name: '',
code: '',
priceType: null,
Min: null,
Max: null,
min: null,
max: null,
brandId: 0,
customerCategoryId: 0,
status: null,
......@@ -478,7 +478,7 @@ const Products: React.FC<{}> = () => {
}
const handleReset = () => {
let restObj = { name: '', code: '', Max: null, Min: null, priceType: null, brandId: 0, customerCategoryId: 0, status: null }
let restObj = { name: '', code: '', max: null, min: null, priceType: null, brandId: 0, customerCategoryId: 0, status: null }
setFilterParams(restObj)
setBrandValue(undefined)
setClassValue(undefined)
......@@ -650,11 +650,11 @@ const Products: React.FC<{}> = () => {
<Input.Group compact>
<Input
type="number"
value={filterParams.Min}
value={filterParams.min}
style={{ width: '40%', textAlign: 'center' }}
min={0}
placeholder="最低价格"
onChange={(e)=>setFilterParams({...filterParams, Min: +e.target.value})}
onChange={(e)=>setFilterParams({...filterParams, min: +e.target.value})}
/>
<Input
style={{
......@@ -670,7 +670,7 @@ const Products: React.FC<{}> = () => {
/>
<Input
type="number"
value={filterParams.Max}
value={filterParams.max}
style={{
width: '40%',
textAlign: 'center',
......@@ -678,7 +678,7 @@ const Products: React.FC<{}> = () => {
}}
min={0}
placeholder="最高价格"
onChange={(e)=>setFilterParams({...filterParams, Max: +e.target.value})}
onChange={(e)=>setFilterParams({...filterParams, max: +e.target.value})}
/>
</Input.Group>
</Col>
......
......@@ -33,6 +33,8 @@ const viewBrand: React.FC<{}> = () => {
setFixStep(0)
else if(res.data.status===2)
setFixStep(1)
else
setFixStep(2)
}
})
PublicApi.getProductBrandGetBrandCheckRecord({brandId: id}).then(res=> {
......@@ -126,7 +128,7 @@ const viewBrand: React.FC<{}> = () => {
}
const tips = <>证明材料<Tooltip title="证明材料:如商标注册证书、品牌授权证书等证明材料"><span>&nbsp;<QuestionCircleOutlined /></span></Tooltip></>
const content = <>
<Descriptions colon={true} style={{textAlign: 'center'}}>
<Descriptions colon={true} style={{textAlign: 'center', marginLeft: 100, width: 800}}>
<Descriptions.Item label="申请审核时间">{brandInfo.applyTime && moment(brandInfo.applyTime).format('YYYY-MM-DD HH:mm:ss')}</Descriptions.Item>
<Descriptions.Item label="审核状态">
{
......
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