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

merge

parents 872c7822 c857db9d
......@@ -71,6 +71,7 @@ export const useLinkEnumEffect = (childKey, transformFn?) => {
type: 'value:linkage',
resolve: ({ origin, target }, { setFieldState, getFieldState }) => {
getFieldState(origin, state => {
console.log('origin', origin, 'state', state)
const { originData = [] } = state
setFieldState(target, targetState => {
if (state.value === undefined) {
......
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 styles from './index.less';
import { PublicApi } from '@/services/api';
......@@ -8,6 +8,7 @@ interface Uploader {
visibleModal: boolean;
fileText: string;
onCancel: Function;
uploadUrl?: string;
}
let timeChange: any;
......@@ -15,6 +16,8 @@ let timeChange: any;
const UploadModal: React.FC<Uploader> = props => {
const [modalTitle, setModalTitle] = useState('导入');
const [modalStep, setModalStep] = useState(0);
const [file, setFile] = useState();
const [fileList, setFileList] = useState([]);
const downLoadTemplate = () => {};
......@@ -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 = '';
switch (type) {
case 'continue':
......@@ -162,6 +175,7 @@ const UploadModal: React.FC<Uploader> = props => {
}
setModalStep(step);
setModalTitle(title);
if (step === 1) return false;
};
const exportErrorLog = () => {};
......@@ -190,13 +204,20 @@ const UploadModal: React.FC<Uploader> = props => {
icon={<FileExcelOutlined />}
title={step0Description}
extra={
<Button
style={{ width: '100%' }}
type="primary"
onClick={() => handleUpload('upload')}
>
上传
// <Upload
// name="file"
// action=""
// fileList={fileList}
// beforeUpload={file => beforeUpload(file)}
// customRequest={file => console.log(file)}
// >
// <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';
import { history } from 'umi';
import { Tabs, Badge, Button, Card, Row, Col, message, Upload } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
ContainerOutlined,
PlusOutlined,
SaveOutlined,
} from '@ant-design/icons';
import { SaveOutlined } from '@ant-design/icons';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
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 { initDetailSchema } from './schema';
import style from './index.less';
import { PublicApi } from '@/services/api';
const { TabPane } = Tabs;
......@@ -27,19 +15,7 @@ const { TabPane } = Tabs;
const addSchemaAction = createFormActions();
const addMember: React.FC<any> = props => {
const ref = useRef({});
const selectList: any = [
{
label: '',
// (
// <>
// <img src={ChinaImg} style={{ width: 24, height: 17 }} /> +86
// </>
// )
value: '1',
},
];
const ref = useRef<any>({});
/* 会员类型、会员角色、会员等级、注册手机号选项 */
const [memberItems, setMemberItems] = useState<any>({});
......
This diff is collapsed.
......@@ -2,57 +2,103 @@ import React from 'react';
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const maintianSchema: ISchema = {
export const importSchema: 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: '请输入仓位名称',
placeholder: '搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component': 'flex-layout',
'x-component-props': {
inline: true,
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
productName: {
memberType: {
type: 'string',
'x-component-props': {
placeholder: '商品名称',
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
productId: {
roleId: {
type: 'string',
'x-component-props': {
placeholder: '商品ID',
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
category: {
level: {
type: 'string',
'x-component-props': {
placeholder: '请选择品类',
placeholder: '请选择',
defaultValue: 0,
},
enum: [],
},
brand: {
source: {
type: 'string',
'x-component-props': {
placeholder: '请选择品牌',
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: '查询',
},
......@@ -64,8 +110,6 @@ export const maintianSchema: ISchema = {
},
};
const registryPhone = <></>;
const getCompnentValue = (elements: any) => {
let components = {};
for (let item of elements) {
......
......@@ -44,7 +44,6 @@
.subCol {
width : 100%;
text-align: right;
.select {
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
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { billsSchema } from './schema';
import UploadModal from '@/components/UploadModal';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { PublicApi } from '@/services/api';
const formActions = createFormActions();
// 模拟请求
const fetchData = async (params: any) => {
const res = await PublicApi.getWarehouseInvoicesList(params);
return res.data;
};
const Bills: React.FC<{}> = () => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [visibleModal, setVisibleModal] = useState(false);
const [moreVisible, setMoreVisible] = useState(false);
const [searchKey, setSearchKey] = useState({
invoicesNo: '',
invoicesType: '',
invoicesAbstract: '',
memberName: '',
inventoryId: '',
startTransactionTime: '',
endTransactionTime: '',
orderNo: '',
state: '',
});
// 获取单据类型
const fetchInvoicesType = async () => {
const { data } = await PublicApi.getWarehouseInvoicesTypeAll();
return data.map(v => ({ label: v.name, value: v.id }));
};
// 获取对应仓库
const fetchInventory = async () => {
const { data } = await PublicApi.getWarehouseWarehouseAll();
return data.map(v => ({ label: v.name, value: v.id }));
};
const menu = (
<Menu onClick={e => handleBatchDel(e)}>
......@@ -108,8 +116,8 @@ const Bills: React.FC<{}> = () => {
dataIndex: 'state',
key: 'state',
filters: [
{ text: 'Male', value: 'male' },
{ text: 'Female', value: 'female' },
{ text: '未审核', value: 1 },
{ text: '已审核', value: 2 },
],
filterMultiple: false,
render: (text: any, record: any) => (
......@@ -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 = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {},
......@@ -213,9 +206,11 @@ const Bills: React.FC<{}> = () => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
'invoicesNo',
FORM_FILTER_PATH,
);
useAsyncSelect('invoicesType', fetchInvoicesType);
useAsyncSelect('inventory', fetchInventory);
}}
schema={billsSchema}
/>
......@@ -223,7 +218,7 @@ const Bills: React.FC<{}> = () => {
/>
<UploadModal
visibleModal={visibleModal}
fileText="会员资料"
fileText="单据资料"
onCancel={() => setVisibleModal(false)}
/>
</Card>
......
......@@ -22,33 +22,28 @@ export const billsSchema: ISchema = {
children: '{{controllerBtns}}',
},
},
search: {
invoicesNo: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '请输入仓位名称',
placeholder: '搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
visible: false,
'x-component': 'flex-layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 8,
rowStyle: {
flexWrap: 'nowrap',
},
properties: {
invoicesNo: {
type: 'string',
'x-component-props': {
placeholder: '单据号',
colStyle: {
marginLeft: 20,
},
},
properties: {
invoicesAbstract: {
type: 'string',
'x-component-props': {
......@@ -81,19 +76,29 @@ export const billsSchema: ISchema = {
},
enum: [],
},
state: {
transactionTime: {
type: 'string',
'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 },
],
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
time: {
type: 'string',
'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