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

merge

parents 872c7822 c857db9d
...@@ -71,6 +71,7 @@ export const useLinkEnumEffect = (childKey, transformFn?) => { ...@@ -71,6 +71,7 @@ export const useLinkEnumEffect = (childKey, transformFn?) => {
type: 'value:linkage', type: 'value:linkage',
resolve: ({ origin, target }, { setFieldState, getFieldState }) => { resolve: ({ origin, target }, { setFieldState, getFieldState }) => {
getFieldState(origin, state => { getFieldState(origin, state => {
console.log('origin', origin, 'state', state)
const { originData = [] } = state const { originData = [] } = state
setFieldState(target, targetState => { setFieldState(target, targetState => {
if (state.value === undefined) { if (state.value === undefined) {
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Modal, Result, Progress, Button } from 'antd'; import { Modal, Result, Progress, Upload, Button } from 'antd';
import { FileExcelOutlined } from '@ant-design/icons'; import { FileExcelOutlined } from '@ant-design/icons';
import styles from './index.less'; import styles from './index.less';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
...@@ -8,6 +8,7 @@ interface Uploader { ...@@ -8,6 +8,7 @@ interface Uploader {
visibleModal: boolean; visibleModal: boolean;
fileText: string; fileText: string;
onCancel: Function; onCancel: Function;
uploadUrl?: string;
} }
let timeChange: any; let timeChange: any;
...@@ -15,6 +16,8 @@ let timeChange: any; ...@@ -15,6 +16,8 @@ let timeChange: any;
const UploadModal: React.FC<Uploader> = props => { const UploadModal: React.FC<Uploader> = props => {
const [modalTitle, setModalTitle] = useState('导入'); const [modalTitle, setModalTitle] = useState('导入');
const [modalStep, setModalStep] = useState(0); const [modalStep, setModalStep] = useState(0);
const [file, setFile] = useState();
const [fileList, setFileList] = useState([]);
const downLoadTemplate = () => {}; const downLoadTemplate = () => {};
...@@ -143,8 +146,18 @@ const UploadModal: React.FC<Uploader> = props => { ...@@ -143,8 +146,18 @@ const UploadModal: React.FC<Uploader> = props => {
/> />
); );
const beforeUpload = file => {
let extension = file.name.split('.')[1];
if (['xlsx', 'xls'].includes[extension]) {
setTimeout(() => {
setExceptionCheck(true);
}, 250);
}
return false;
};
// 上传 // 上传
const handleUpload = (type: string, step: number = 0) => { const handleUpload = (type: string, file?: any, step: number = 0) => {
let title = ''; let title = '';
switch (type) { switch (type) {
case 'continue': case 'continue':
...@@ -162,6 +175,7 @@ const UploadModal: React.FC<Uploader> = props => { ...@@ -162,6 +175,7 @@ const UploadModal: React.FC<Uploader> = props => {
} }
setModalStep(step); setModalStep(step);
setModalTitle(title); setModalTitle(title);
if (step === 1) return false;
}; };
const exportErrorLog = () => {}; const exportErrorLog = () => {};
...@@ -190,13 +204,20 @@ const UploadModal: React.FC<Uploader> = props => { ...@@ -190,13 +204,20 @@ const UploadModal: React.FC<Uploader> = props => {
icon={<FileExcelOutlined />} icon={<FileExcelOutlined />}
title={step0Description} title={step0Description}
extra={ extra={
<Button // <Upload
style={{ width: '100%' }} // name="file"
type="primary" // action=""
onClick={() => handleUpload('upload')} // fileList={fileList}
> // beforeUpload={file => beforeUpload(file)}
上传 // customRequest={file => console.log(file)}
</Button> // >
// <Button type="primary">导入</Button>
// </Upload>
<>
<Button type="primary" onClick={() => handleUpload('upload')}>
导入
</Button>
</>
} }
/> />
</> </>
......
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd'
import { useLinkageUtils } from '@/utils/formEffectUtils'
const { onFormInit$ } = FormEffectHooks
/**
* @description 处理异步请求的下拉选择
* @param name 待处理的表单路径
* @param service 触发的异步函数, 需返回一个{label: any, value: any}形式的数组
*/
export const useAsyncInitSelect = (name: string[], service?: () => Promise<any>) => {
const { dispatch, setFieldState } = createFormActions()
const linkage = useLinkageUtils()
onFormInit$().subscribe(() => {
setFieldState(name, state => {
FormPath.setIn(state, 'props.x-props.hasFeedback', true)
})
name.forEach(v => linkage.loaded(v))
service().then(res => {
console.log(res)
name.forEach(v => {
linkage.loaded(v)
linkage.enum(v, res[v])
})
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
dispatch('requestAsyncSelect', {
name,
payload: res
})
}).catch(err => {
// linkage.loaded(name)
// linkage.enum(name, [])
})
})
}
\ No newline at end of file
This diff is collapsed.
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const auditSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
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}}',
},
},
search: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
memberType: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
roleId: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
level: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
source: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
timeRange: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [
{ label: '时间范围(全部)', value: 0 },
{ label: '今天', value: 1 },
{ label: '一周内', value: 2 },
{ label: '一个月内', value: 3 },
{ label: '三个月内', value: 4 },
{ label: '六个月内', value: 5 },
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7 },
],
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
...@@ -2,24 +2,12 @@ import React, { useState, useEffect, useRef, ReactNode } from 'react'; ...@@ -2,24 +2,12 @@ import React, { useState, useEffect, useRef, ReactNode } from 'react';
import { history } from 'umi'; import { history } from 'umi';
import { Tabs, Badge, Button, Card, Row, Col, message, Upload } from 'antd'; import { Tabs, Badge, Button, Card, Row, Col, message, Upload } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { import { SaveOutlined } from '@ant-design/icons';
ContainerOutlined,
PlusOutlined,
SaveOutlined,
} from '@ant-design/icons';
import { createFormActions } from '@formily/antd'; import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import {
IFormFilter,
IButtonFilter,
} from 'god/dist/src/standard-table/TableController';
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import styles from './index.less';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import { initDetailSchema } from './schema'; import { initDetailSchema } from './schema';
import style from './index.less';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
const { TabPane } = Tabs; const { TabPane } = Tabs;
...@@ -27,19 +15,7 @@ const { TabPane } = Tabs; ...@@ -27,19 +15,7 @@ const { TabPane } = Tabs;
const addSchemaAction = createFormActions(); const addSchemaAction = createFormActions();
const addMember: React.FC<any> = props => { const addMember: React.FC<any> = props => {
const ref = useRef({}); const ref = useRef<any>({});
const selectList: any = [
{
label: '',
// (
// <>
// <img src={ChinaImg} style={{ width: 24, height: 17 }} /> +86
// </>
// )
value: '1',
},
];
/* 会员类型、会员角色、会员等级、注册手机号选项 */ /* 会员类型、会员角色、会员等级、注册手机号选项 */
const [memberItems, setMemberItems] = useState<any>({}); const [memberItems, setMemberItems] = useState<any>({});
......
This diff is collapsed.
...@@ -2,57 +2,103 @@ import React from 'react'; ...@@ -2,57 +2,103 @@ import React from 'react';
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
export const maintianSchema: ISchema = { export const importSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
megaLayout: { megaLayout: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'mega-layout',
properties: { properties: {
search: { topLayout: {
type: 'string', type: 'object',
'x-component': 'Search', 'x-component': 'mega-layout',
'x-mega-props': {},
'x-component-props': { 'x-component-props': {
placeholder: '请输入仓位名称', grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{controllerBtns}}',
},
},
search: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '搜索',
},
},
}, },
}, },
[FORM_FILTER_PATH]: { [FORM_FILTER_PATH]: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'flex-layout',
visible: false,
'x-component-props': { 'x-component-props': {
inline: true, rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
}, },
properties: { properties: {
productName: { memberType: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '商品名称', placeholder: '请选择',
defaultValue: 0,
}, },
enum: [],
}, },
productId: { roleId: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '商品ID', placeholder: '请选择',
defaultValue: 0,
}, },
enum: [],
}, },
category: { level: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '请选择品类', placeholder: '请选择',
defaultValue: 0,
}, },
enum: [], enum: [],
}, },
brand: { source: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '请选择品牌', placeholder: '请选择',
defaultValue: 0,
}, },
enum: [], enum: [],
}, },
timeRange: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [
{ label: '时间范围(全部)', value: 0 },
{ label: '今天', value: 1 },
{ label: '一周内', value: 2 },
{ label: '一个月内', value: 3 },
{ label: '三个月内', value: 4 },
{ label: '六个月内', value: 5 },
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7 },
],
},
submit: { submit: {
'x-component': 'Submit', 'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': { 'x-component-props': {
children: '查询', children: '查询',
}, },
...@@ -64,8 +110,6 @@ export const maintianSchema: ISchema = { ...@@ -64,8 +110,6 @@ export const maintianSchema: ISchema = {
}, },
}; };
const registryPhone = <></>;
const getCompnentValue = (elements: any) => { const getCompnentValue = (elements: any) => {
let components = {}; let components = {};
for (let item of elements) { for (let item of elements) {
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
.subCol { .subCol {
width : 100%; width : 100%;
text-align: right;
.select { .select {
width : 160px; width : 160px;
......
This diff is collapsed.
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const maintianSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
search: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 6,
},
properties: {
memberType: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
roleId: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
level: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
source: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
timeRange: {
type: 'string',
'x-component-props': {
placeholder: '请选择',
defaultValue: 0,
},
enum: [
{ label: '时间范围(全部)', value: 0 },
{ label: '今天', value: 1 },
{ label: '一周内', value: 2 },
{ label: '一个月内', value: 3 },
{ label: '三个月内', value: 4 },
{ label: '六个月内', value: 5 },
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7 },
],
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
...@@ -12,26 +12,34 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -12,26 +12,34 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { billsSchema } from './schema'; import { billsSchema } from './schema';
import UploadModal from '@/components/UploadModal'; import UploadModal from '@/components/UploadModal';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
const formActions = createFormActions(); const formActions = createFormActions();
// 模拟请求
const fetchData = async (params: any) => {
const res = await PublicApi.getWarehouseInvoicesList(params);
return res.data;
};
const Bills: React.FC<{}> = () => { const Bills: React.FC<{}> = () => {
const ref = useRef<any>({}); const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]); const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [visibleModal, setVisibleModal] = useState(false); const [visibleModal, setVisibleModal] = useState(false);
const [moreVisible, setMoreVisible] = useState(false); const [moreVisible, setMoreVisible] = useState(false);
const [searchKey, setSearchKey] = useState({
invoicesNo: '', // 获取单据类型
invoicesType: '', const fetchInvoicesType = async () => {
invoicesAbstract: '', const { data } = await PublicApi.getWarehouseInvoicesTypeAll();
memberName: '', return data.map(v => ({ label: v.name, value: v.id }));
inventoryId: '', };
startTransactionTime: '',
endTransactionTime: '', // 获取对应仓库
orderNo: '', const fetchInventory = async () => {
state: '', const { data } = await PublicApi.getWarehouseWarehouseAll();
}); return data.map(v => ({ label: v.name, value: v.id }));
};
const menu = ( const menu = (
<Menu onClick={e => handleBatchDel(e)}> <Menu onClick={e => handleBatchDel(e)}>
...@@ -108,8 +116,8 @@ const Bills: React.FC<{}> = () => { ...@@ -108,8 +116,8 @@ const Bills: React.FC<{}> = () => {
dataIndex: 'state', dataIndex: 'state',
key: 'state', key: 'state',
filters: [ filters: [
{ text: 'Male', value: 'male' }, { text: '未审核', value: 1 },
{ text: 'Female', value: 'female' }, { text: '已审核', value: 2 },
], ],
filterMultiple: false, filterMultiple: false,
render: (text: any, record: any) => ( render: (text: any, record: any) => (
...@@ -149,21 +157,6 @@ const Bills: React.FC<{}> = () => { ...@@ -149,21 +157,6 @@ const Bills: React.FC<{}> = () => {
}, },
]; ];
// 模拟请求
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getWarehouseInvoicesList({
...searchKey,
current: params.current,
pageSize: params.pageSize,
}).then(res => {
resolve(res.data);
});
});
};
const handleAdd = () => {};
const rowSelection = { const rowSelection = {
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {}, onChange: (selectedRowKeys: any, selectedRows: any) => {},
...@@ -213,9 +206,11 @@ const Bills: React.FC<{}> = () => { ...@@ -213,9 +206,11 @@ const Bills: React.FC<{}> = () => {
useStateFilterSearchLinkageEffect( useStateFilterSearchLinkageEffect(
$, $,
actions, actions,
'search', 'invoicesNo',
FORM_FILTER_PATH, FORM_FILTER_PATH,
); );
useAsyncSelect('invoicesType', fetchInvoicesType);
useAsyncSelect('inventory', fetchInventory);
}} }}
schema={billsSchema} schema={billsSchema}
/> />
...@@ -223,7 +218,7 @@ const Bills: React.FC<{}> = () => { ...@@ -223,7 +218,7 @@ const Bills: React.FC<{}> = () => {
/> />
<UploadModal <UploadModal
visibleModal={visibleModal} visibleModal={visibleModal}
fileText="会员资料" fileText="单据资料"
onCancel={() => setVisibleModal(false)} onCancel={() => setVisibleModal(false)}
/> />
</Card> </Card>
......
...@@ -22,33 +22,28 @@ export const billsSchema: ISchema = { ...@@ -22,33 +22,28 @@ export const billsSchema: ISchema = {
children: '{{controllerBtns}}', children: '{{controllerBtns}}',
}, },
}, },
search: { invoicesNo: {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-mega-props': {}, 'x-mega-props': {},
'x-component-props': { 'x-component-props': {
placeholder: '请输入仓位名称', placeholder: '搜索',
}, },
}, },
}, },
}, },
[FORM_FILTER_PATH]: { [FORM_FILTER_PATH]: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'flex-layout',
visible: false,
'x-component-props': { 'x-component-props': {
grid: true, rowStyle: {
full: true, flexWrap: 'nowrap',
autoRow: true, },
columns: 8, colStyle: {
marginLeft: 20,
},
}, },
properties: { properties: {
invoicesNo: {
type: 'string',
'x-component-props': {
placeholder: '单据号',
},
},
invoicesAbstract: { invoicesAbstract: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
...@@ -81,19 +76,29 @@ export const billsSchema: ISchema = { ...@@ -81,19 +76,29 @@ export const billsSchema: ISchema = {
}, },
enum: [], enum: [],
}, },
state: { transactionTime: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '请选择单据状态', placeholder: '请选择交易时间',
}, },
enum: [], enum: [
{ label: '今天', value: 1 },
{ label: '一周内', value: 2 },
{ label: '一个月内', value: 3 },
{ label: '三个月内', value: 4 },
{ label: '六个月内', value: 5 },
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7 },
],
}, },
time: { submit: {
type: 'string', 'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': { 'x-component-props': {
placeholder: '请选择交易时间', children: '查询',
}, },
enum: [],
}, },
}, },
}, },
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment