Commit f1839341 authored by GuanHua's avatar GuanHua
parents 98587de9 01c90c71
/* /*
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-31 19:56:22 * @Date: 2020-07-31 19:56:22
* @LastEditors: LeeJiancong * @LastEditors: XieZhiXiong
* @Copyright: 1549414730@qq.com * @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-15 17:18:01 * @LastEditTime: 2020-09-16 15:37:06
*/ */
const TranactionRoute = { const TranactionRoute = {
...@@ -48,7 +48,7 @@ const TranactionRoute = { ...@@ -48,7 +48,7 @@ const TranactionRoute = {
path: '/memberCenter/tranactionAbility/stockSellStorage/addBills', path: '/memberCenter/tranactionAbility/stockSellStorage/addBills',
name: 'addBills', name: 'addBills',
hideInMenu: true, hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/bills/addBills', component: '@/pages/transaction/stockSellStorage/bills/addBills/index',
}, },
{ {
path: '/memberCenter/tranactionAbility/stockSellStorage/inventory', path: '/memberCenter/tranactionAbility/stockSellStorage/inventory',
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect } from 'react';
import { Row, Col, Input, Button, Modal } from 'antd'; import { Input, Button } from 'antd';
import { LinkOutlined } from '@ant-design/icons'; import { LinkOutlined } from '@ant-design/icons';
import styled from 'styled-components'; import styled from 'styled-components';
import cx from 'classnames'; import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { StandardTable } from 'god'; import ModalTable from '@/components/ModalTable';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
const formActions = createFormActions();
const RowStyleLayout = styled(props => <div {...props} />)` const RowStyleLayout = styled(props => <div {...props} />)`
width: 100%; width: 100%;
.relevance { .relevance {
border-color: #6b778c; border-color: #6b778c;
background-color: #6b778c; background-color: #6b778c;
border-radius: 0;
}
.ant-input-group-addon {
padding: 0;
} }
`; `;
const data = [ const Relevance = props => {
{ const {
key: '1', editable,
role: '采购商', value = [],
businessType: '采购', } = props;
roleType: '服务消费',
memberType: '企业会员',
},
{
key: '2',
role: '供应商',
businessType: '商品供应',
roleType: '服务提供',
memberType: '企业会员',
},
];
// 模拟请求 const {
const fetchData = (params: any) => { modalProps = {
return new Promise((resolve, reject) => { title: '标题',
const queryResult = data.find(v => v.key === params.keywords); width: 960,
setTimeout(() => { },
resolve({ selectionType = 'radio',
code: 200, columns,
message: '', formilyProps,
data: queryResult ? [queryResult] : data, tableProps = {},
}); fetchTableData,
}, 1000); title = '选择',
}); } = props.props['x-component-props'];
};
const tableRowKey = tableProps.rowKey || 'id';
const tableRowLableKey = tableProps.lableKey || ''; // Input展示用的 key val
const Relevance = props => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const propsParams = props.props['x-component-props']; const [rowSelection, rowCtl] = useRowSelectionTable({ type: selectionType });
useEffect(() => { useEffect(() => {
console.log('props', propsParams); // Table 只能缓存 keys
}, []); const rowKeys = value.map(item => item[tableRowKey]);
rowCtl.setSelectedRowKeys(rowKeys);
}, [props.value]);
const handlePreview = () => { const handleConfirm = () => {
setVisible(!visible); const rows = rowCtl.selectRow;
}; const keys = rows.map(item => item[tableRowKey]);
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {},
};
const handleSubmit = type => { if (props.mutators) {
if (type === 'confirm') { props.mutators.change(rows);
} else { setVisible(false);
return;
} }
rowCtl.setSelectedRowKeys(keys);
setVisible(false); setVisible(false);
}; };
return ( return (
<RowStyleLayout> <RowStyleLayout>
<Row> <Input
<Col span={16}> value={
<Input disabled></Input> tableRowLableKey ?
</Col> value.map(item => item[tableRowLableKey]).join(',') :
<Col span={8}> '请指明 lableKey 值'
<Button }
type="primary" addonAfter={(
className="relevance" <>
icon={<LinkOutlined />} {editable && (
onClick={handlePreview} <Button
> type="primary"
关联 className="relevance"
</Button> icon={<LinkOutlined />}
</Col> onClick={() => setVisible(true)}
</Row> block
>
{title}
</Button>
)}
</>
)}
disabled
/>
<Modal <ModalTable
title={propsParams.modalTitle || ''} confirm={handleConfirm}
cancel={() => setVisible(false)}
visible={visible} visible={visible}
width={propsParams.modalWidth || ''} width={960}
destroyOnClose {...modalProps}
onOk={() => handleSubmit('confirm')} modalTitle={modalProps.title}
onCancel={() => handleSubmit('cancel')} rowSelection={rowSelection}
> columns={columns}
<StandardTable fetchTableData={fetchTableData}
columns={propsParams.modalColumns} formilyProps={formilyProps}
currentRef={ref} tableProps={tableProps}
tableProps={{ rowKey: 'key' }} />
rowSelection={rowSelection}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
}}
schema={propsParams.modalSchema}
/>
}
/>
</Modal>
</RowStyleLayout> </RowStyleLayout>
); );
}; };
......
...@@ -128,9 +128,10 @@ const SearchSelect = (props: ISchemaFieldComponentProps) => { ...@@ -128,9 +128,10 @@ const SearchSelect = (props: ISchemaFieldComponentProps) => {
filterOption={false} filterOption={false}
loading={loading} loading={loading}
options={dataSource} options={dataSource}
getPopupContainer={triggerNode => { // getPopupContainer={triggerNode => {
return triggerNode // return triggerNode
}} // }}
getPopupContainer={() => document.getElementById('root')} /* 处理option被遮挡 */
value={props.value} value={props.value}
dropdownRender={originNode => <SelectContent confirm={confirm} resetField={resetField} parentRef={ref} handleChange={handleChange} multiple={multiple} value={props.value}>{originNode}</SelectContent>} dropdownRender={originNode => <SelectContent confirm={confirm} resetField={resetField} parentRef={ref} handleChange={handleChange} multiple={multiple} value={props.value}>{originNode}</SelectContent>}
{...multipleProps} {...multipleProps}
......
...@@ -300,6 +300,13 @@ export const DOC_DIRECTION = { ...@@ -300,6 +300,13 @@ export const DOC_DIRECTION = {
[DOC_DIRECTION_OUTGOING]: '出库 - ', [DOC_DIRECTION_OUTGOING]: '出库 - ',
}; };
// 对应单据
export const DEPENDENT_DOC_ORDER = 1; // 订单
export const DEPENDENT_DOC_EXCHANGE = 2; // 换货
export const DEPENDENT_DOC_RETURN = 3; // 退货
export const DEPENDENT_DOC_PRODUCTION = 4; // 生产
export const DEPENDENT_DOC_INTERNAL = 5; // 内部
// 订单类型 // 订单类型
export const ORDER_TYPE2_INQUIRY = 1; // 询价采购 export const ORDER_TYPE2_INQUIRY = 1; // 询价采购
export const ORDER_TYPE2_DEMAND = 2; // 需求采购 export const ORDER_TYPE2_DEMAND = 2; // 需求采购
...@@ -318,4 +325,8 @@ export const ORDER_TYPE2 = { ...@@ -318,4 +325,8 @@ export const ORDER_TYPE2 = {
[ORDER_TYPE2_CHANNEL_DIRECT]: '渠道直采', [ORDER_TYPE2_CHANNEL_DIRECT]: '渠道直采',
[ORDER_TYPE2_CHANNEL_SPOT]: '渠道现货', [ORDER_TYPE2_CHANNEL_SPOT]: '渠道现货',
[ORDER_TYPE2_CHANNEL_POINTS]: '渠道积分兑换', [ORDER_TYPE2_CHANNEL_POINTS]: '渠道积分兑换',
}; };
\ No newline at end of file
// 会员角色类型
export const MEMBER_ROLE_TYPE_SERVICE_PROVIDER = 1; // 服务提供者
export const MEMBER_ROLE_TYPE_SERVICE_CONSUMER = 2; // 服务消费者
\ No newline at end of file
...@@ -307,27 +307,76 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -307,27 +307,76 @@ const DirectChannel: React.FC<{}> = () => {
const handleUpDown = () => { const handleUpDown = () => {
setIsDisabledOKbtn(true) setIsDisabledOKbtn(true)
let params: any = { let params: any = {}
idList: isBatchOption ? selectRow.map(item => item.id) : [currentOptionId], if(isBatchOption){
shopList: checkedValues params = {
idList: selectRow.map(item => item.id),
shopList: checkedValues
}
}else{
params = {
id: currentOptionId,
shopList: checkedValues
}
} }
if(isUp)
if(checkedValues.length > 0){ if(isBatchOption){ // 批量操作区分上下架
PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => { if(isUp){
if(checkedValues.length > 0){
PublicApi.postProductChannelCommodityBatchPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}else{
setIsDisabledOKbtn(false)
message.error('请选择需要上架的渠道商城')
}
}else{
PublicApi.postProductChannelCommodityBatchOffPublishCommodity(params).then(res => {
setUpDownModal(false) setUpDownModal(false)
ref.current.reload() ref.current.reload()
setIsDisabledOKbtn(false) setIsDisabledOKbtn(false)
}) })
}
}else{
if(isUp){
if(checkedValues.length > 0){
PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}else{
setIsDisabledOKbtn(false)
message.error('请选择需要上架的渠道商城')
}
}else{ }else{
setIsDisabledOKbtn(false) PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
message.error('请选择需要上架的渠道商城') setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
} }
else }
PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
setUpDownModal(false) // if(isUp)
ref.current.reload() // if(checkedValues.length > 0){
setIsDisabledOKbtn(false) // PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
}) // setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
// }else{
// setIsDisabledOKbtn(false)
// message.error('请选择需要上架的渠道商城')
// }
// else
// PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
} }
......
...@@ -208,150 +208,64 @@ export const channelSchema: ISchema = { ...@@ -208,150 +208,64 @@ export const channelSchema: ISchema = {
// 添加渠道商品模态框高级筛选 // 添加渠道商品模态框高级筛选
export const addChannelSchema: ISchema = { export const addChannelSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
name: { name: {
type: 'string', type: 'string',
'x-component': 'ModalSearch', 'x-component': 'ModalSearch',
'x-component-props': { 'x-component-props': {
placeholder: '商品名称', placeholder: '商品名称',
align: 'flex-left', align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
}, },
}, },
[FORM_FILTER_PATH]: { properties: {
type: 'object', categoryId: {
'x-component': 'flex-layout', type: 'string',
'x-component-props': { "x-component": 'SearchSelect',
rowStyle: { "x-component-props": {
flexWrap: 'nowrap', placeholder: '请选择品类',
style: { className: 'fixed-ant-selected-down',
marginRight: 0 fetchSearch: PublicApi.getProductSelectGetSelectCategory,
} }
},
colStyle: {
marginTop: 20,
},
}, },
properties: { brandId: {
categoryId: { type: 'string',
type: 'string', "x-component": 'SearchSelect',
"x-component": 'SearchSelect', "x-component-props": {
"x-component-props": { placeholder: '请选择品牌',
placeholder: '请选择品类', fetchSearch: PublicApi.getProductSelectGetSelectBrand,
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ?? }
fetchSearch: PublicApi.getProductSelectGetSelectCategory, },
} parentMemberId: {
}, type: 'string',
brandId: { enum: [],
type: 'string', 'x-component-props': {
"x-component": 'SearchSelect', placeholder: '上级渠道',
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
}
}, },
parentMemberId: { },
type: 'string', submit: {
enum: [], "x-component": 'Submit',
'x-component-props': { "x-mega-props": {
placeholder: '上级渠道', span: 1
},
}, },
submit: { "x-component-props": {
"x-component": 'Submit', children: '查询'
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
} }
} }
} }
} }
}
// type: 'object',
// properties: {
// mageLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// properties: {
// topLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// grid: true,
// },
// properties: {
// 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',
// justifyContent: 'flex-start'
// },
// colStyle: {
// marginLeft: 20,
// },
// },
// properties: {
// brandId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品牌',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// customerCategoryId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品类',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// parentMemberId: {
// type: 'string',
// enum: [],
// 'x-component-props': {
// placeholder: '上级渠道',
// },
// },
// submit: {
// 'x-component': 'Submit',
// 'x-mega-props': {
// span: 1,
// },
// 'x-component-props': {
// children: '查询',
// },
// },
// },
// },
// },
// },
// },
} }
\ No newline at end of file
...@@ -45,7 +45,7 @@ const BasicInfo: React.FC<BasicInfoProps> = ({ ...@@ -45,7 +45,7 @@ const BasicInfo: React.FC<BasicInfoProps> = ({
channel = {}, channel = {},
extra = [], extra = [],
outerHistory = [], outerHistory = [],
innerHistory = [], innerHistory,
channelRender, channelRender,
}) => { }) => {
......
...@@ -42,7 +42,7 @@ interface FlowRecordsProps { ...@@ -42,7 +42,7 @@ interface FlowRecordsProps {
innerHistory?: InnerHistoryItem[]; innerHistory?: InnerHistoryItem[];
}; };
const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory = [] }) => { const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory }) => {
const outerColumns: EditableColumns[] = [ const outerColumns: EditableColumns[] = [
{ {
...@@ -143,14 +143,16 @@ const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHisto ...@@ -143,14 +143,16 @@ const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHisto
pagination={null} pagination={null}
/> />
</Tabs.TabPane> </Tabs.TabPane>
<Tabs.TabPane tab="内部单据流转记录" key="2"> {innerHistory && (
<PolymericTable <Tabs.TabPane tab="内部单据流转记录" key="2">
dataSource={innerHistory} <PolymericTable
columns={innerColumns} dataSource={innerHistory}
loading={false} columns={innerColumns}
pagination={null} loading={false}
/> pagination={null}
</Tabs.TabPane> />
</Tabs.TabPane>
)}
</Tabs> </Tabs>
</MellowCard> </MellowCard>
); );
......
...@@ -25,11 +25,13 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -25,11 +25,13 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { getAuth } from '@/utils/auth';
import { import {
MEMBER_OUTER_STATUS, MEMBER_OUTER_STATUS,
MEMBER_OUTER_STATUS_UNCOMMITTED, MEMBER_OUTER_STATUS_UNCOMMITTED,
MEMBER_OUTER_STATUS_SUCCESS, MEMBER_OUTER_STATUS_SUCCESS,
MEMBER_OUTER_STATUS_FAILED, MEMBER_OUTER_STATUS_FAILED,
MEMBER_ROLE_TYPE_SERVICE_PROVIDER,
} from '@/constants'; } from '@/constants';
import StatusTag from '../components/StatusTag'; import StatusTag from '../components/StatusTag';
import { importSchema, auditModalSchema } from './schema'; import { importSchema, auditModalSchema } from './schema';
...@@ -48,6 +50,8 @@ const MemberMaintain: React.FC<[]> = () => { ...@@ -48,6 +50,8 @@ const MemberMaintain: React.FC<[]> = () => {
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]); const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [visibleModal, setVisibleModal] = useState(false); const [visibleModal, setVisibleModal] = useState(false);
const userInfo = getAuth();
const handleDelete = (memberId: number, validateId: number) => { const handleDelete = (memberId: number, validateId: number) => {
const mesInstance = message.loading({ const mesInstance = message.loading({
content: '正在删除', content: '正在删除',
...@@ -258,23 +262,27 @@ const MemberMaintain: React.FC<[]> = () => { ...@@ -258,23 +262,27 @@ const MemberMaintain: React.FC<[]> = () => {
const controllerBtns = ( const controllerBtns = (
<Space> <Space>
<Button {userInfo.memberRoleType === MEMBER_ROLE_TYPE_SERVICE_PROVIDER && (
type="primary" <>
onClick={() => <Button
history.push(`/memberCenter/memberAbility/manage/addMember`) type="primary"
} onClick={() =>
> history.push(`/memberCenter/memberAbility/manage/addMember`)
<PlusOutlined /> }
新建 >
</Button> <PlusOutlined />
<Button onClick={() => setVisibleModal(true)}>导入</Button> 新建
<Dropdown.Button </Button>
overlay={menu} <Button onClick={() => setVisibleModal(true)}>导入</Button>
trigger={['click']} <Dropdown.Button
icon={<DownOutlined />} overlay={menu}
> trigger={['click']}
更多 icon={<DownOutlined />}
</Dropdown.Button> >
更多
</Dropdown.Button>
</>
)}
</Space> </Space>
); );
......
import React from 'react'; import React from 'react';
import { Steps } from 'antd'; import { Steps } from 'antd';
import { observer, inject } from 'mobx-react';
import { IMemberModule } from '@/module/memberModule';
import MellowCard from '@/components/MellowCard'; import MellowCard from '@/components/MellowCard';
import BasicInfo from '../../components/BasicInfo'; import BasicInfo from '../../components/BasicInfo';
const MemberBasicInfo: React.FC<{}> = () => { interface MemberBasicInfoProps {
MemberStore?: IMemberModule;
};
const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({
MemberStore,
}) => {
const { memberMaintainInfo } = MemberStore;
return ( return (
<div> <div>
<MellowCard <MellowCard
...@@ -12,16 +22,32 @@ const MemberBasicInfo: React.FC<{}> = () => { ...@@ -12,16 +22,32 @@ const MemberBasicInfo: React.FC<{}> = () => {
marginBottom: 24, marginBottom: 24,
}} }}
> >
<Steps style={{ marginTop: 30 }} progressDot current={2}> <Steps style={{ marginTop: 30 }} progressDot current={memberMaintainInfo?.currentOuterStep}>
<Steps.Step title="业务角色" description="申请审核" /> {memberMaintainInfo.outerVerifySteps ? memberMaintainInfo.outerVerifySteps.map((item, index) => (
<Steps.Step title="业务角色" description="审核会员" /> <Steps.Step key={index} title={item.roleName} description={item.stepName} />
<Steps.Step title="完成" description="" /> )) : null}
</Steps> </Steps>
</MellowCard> </MellowCard>
<BasicInfo /> <BasicInfo
basic={{
account: memberMaintainInfo?.account,
phone: memberMaintainInfo?.phone,
email: memberMaintainInfo?.email,
created: memberMaintainInfo?.createTime,
}}
channel={{
memberType: memberMaintainInfo?.memberTypeEnum,
level: memberMaintainInfo?.channelLevelTag,
type: memberMaintainInfo?.channelTypeName,
areas: memberMaintainInfo?.areas,
desc: memberMaintainInfo?.remark,
}}
extra={memberMaintainInfo?.groups}
outerHistory={memberMaintainInfo?.outerHistory}
/>
</div> </div>
); );
}; };
export default MemberBasicInfo; export default inject('MemberStore')(observer(MemberBasicInfo));
\ No newline at end of file \ No newline at end of file
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
* @Date: 2020-08-24 11:39:11 * @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com * @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-10 11:42:28 * @LastEditTime: 2020-09-16 16:28:24
*/ */
/** /**
* @description: 组件描述: 一级 二级 待提交需求 * @description: 组件描述: 一级 二级 待提交报价
* @param {type} * @param {type}
* @return {type} * @return {type}
*/ */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Date: 2020-08-28 10:07:45 * @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com * @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-16 14:23:28 * @LastEditTime: 2020-09-16 16:46:52
*/ */
import React, { Component, useState,useRef, useEffect,useImperativeHandle } from 'react'; import React, { Component, useState,useRef, useEffect,useImperativeHandle } from 'react';
import { Modal, Button,Space, Form, Radio, AutoComplete, Badge,Tabs, Input, Select, Checkbox } from 'antd' import { Modal, Button,Space, Form, Radio, AutoComplete, Badge,Tabs, Input, Select, Checkbox } from 'antd'
...@@ -120,7 +120,7 @@ const columns: ColumnType<any>[] = [ ...@@ -120,7 +120,7 @@ const columns: ColumnType<any>[] = [
const comfirmDialog: React.FC<Params> = (props,{onRef}) => { const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
// const {onRef} = props // const {onRef} = props
// const cRef = props.currentRef // const cRef = props.currentRef
console.log('数据',props) // console.log('数据',props)
const [visible, setsVisible] = useState(false) //state hook写法 const [visible, setsVisible] = useState(false) //state hook写法
...@@ -152,7 +152,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => { ...@@ -152,7 +152,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
} }
const handleSelectOk = () => { const handleSelectOk = () => {
console.log('数据', productRowCtl);
const selectRow = productRowCtl.selectRow[0] const selectRow = productRowCtl.selectRow[0]
let { commodityId, id,customerCategoryName, goodsId, roleId, name, brandName } = selectRow let { commodityId, id,customerCategoryName, goodsId, roleId, name, brandName } = selectRow
Curform.setFieldsValue({ Curform.setFieldsValue({
...@@ -191,7 +190,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => { ...@@ -191,7 +190,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
*/ */
const handletOk = () => { const handletOk = () => {
Curform.validateFields().then(v => { Curform.validateFields().then(v => {
console.log('表单', v)
props.onOK(v,commodityAttributedataSource) props.onOK(v,commodityAttributedataSource)
props.productAttributeJson(commodityAttributedataSource) props.productAttributeJson(commodityAttributedataSource)
Curform.resetFields() Curform.resetFields()
...@@ -202,7 +200,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => { ...@@ -202,7 +200,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
// onRef(inRef) // onRef(inRef)
if( id && props.mode == 0){//新增重置 if( id && props.mode == 0){//新增重置
console.log(31212)
Curform.setFieldsValue({ Curform.setFieldsValue({
model:'', model:'',
productId:'', productId:'',
...@@ -214,7 +211,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => { ...@@ -214,7 +211,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
} }
}, []) }, [])
useEffect(() => { useEffect(() => {
console.log('重置',props.mode)
if(props.initialValues && props.initialValues.productId){ if(props.initialValues && props.initialValues.productId){
GetCommodityAttribute(props.initialValues.productId) GetCommodityAttribute(props.initialValues.productId)
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:29 * @Date: 2020-08-24 11:39:29
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com * @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-16 14:25:16 * @LastEditTime: 2020-09-16 18:15:58
*/ */
import React, { Component, useState, useEffect,useRef } from 'react' import React, { Component, useState, useEffect,useRef } from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
...@@ -355,60 +355,6 @@ const Detail: React.FC<{}> = () => { ...@@ -355,60 +355,6 @@ const Detail: React.FC<{}> = () => {
} }
/** /**
* @description: 初始化需求对接表格 需求单
* @param {type}
* @return {type}
*/
const InitMemberList = () => {
let params: any = {}
params.categoryId = categoryId
let codeList = tabForm.getFieldValue('requisitionFormAddress') || []
if (categoryId && otherList.length != 0) {
console.log('codeList', codeList)
params.areaRequestList =
codeList.map((v: any) => {
if (Array.isArray(v)) {
return ({
provinceCode: v[0],
cityCode: v && v.length > 1 ? v[1] : null
})
}
})
let productList = []
productSource.forEach((v) => {
// console.log('v',v)
let item: any = {}
Object.keys(v).forEach(child => {
otherList.forEach((j: any) => {
let otherItem: any = {}
if (child === j.title) {
otherItem['attributeId'] = j.key
otherItem['attributeValue'] = v[child]
productList.push(otherItem)
}
})
})
})
params.attributeList = [...productList]
params.current = 1
params.pageSize = 20
console.log('params', JSON.stringify(params))
PublicApi.postOrderSystemMatchingMemberInitializeList(
params
).then(res => {
if (res.code === 1000) {
let { data } = res.data || {}
setdockingList(data)
}
})
}
}
/**
* @description: 生产商品动态弹窗 * @description: 生产商品动态弹窗
* @param {type} seletCategoryId品类id needotherCoumns 需要展示动态列 * @param {type} seletCategoryId品类id needotherCoumns 需要展示动态列
* @return {type} * @return {type}
...@@ -447,87 +393,6 @@ const Detail: React.FC<{}> = () => { ...@@ -447,87 +393,6 @@ const Detail: React.FC<{}> = () => {
} }
/** /**
* @description: 选择品类
* @param {type}
* @return {type}
*/
const onCustomerCategoryChange = (value: any, options: any) => {
console.log(3112, value, options)
let seletCategoryId = value[value.length - 1]
setcategoryId(seletCategoryId)
setseletCategoryNameList(options)
if(id){
sethaschangeCategory(true)
}else{
sethaschangeCategory(false)
}
console.log(seletCategoryId, 'seleellele')
initCreatePro(seletCategoryId)
}
/**
* @description: 需求格式
* @param {type}
* @return {type}
*/
const dockingColumn: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '会员名称',
dataIndex: 'memberName',
key: 'memberName',
align: 'left'
},
{
title: '会员类型',
dataIndex: 'memberTypeName',
key: 'memberTypeName',
align: 'center'
},
{
title: '会员角色',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '会员等级',
dataIndex: 'levelTag',
key: 'levelTag',
align: 'center'
},
{
title: '是否归属会员',
dataIndex: 'membershipOrNot',
key: 'membershipOrNot',
align: 'center',
render: (text: any) => (
text == 0 ? '否' : '是'
)
},
{
title: '需求发送状态',
dataIndex: 'state',
key: 'state',
align: 'center',
render:(text:any,records,index) =>
<Switch defaultChecked={text ? true : false} size="small" onChange={(checked) => {
console.log(checked);
dockingList[index].state = checked? 1 : 0
setdockingList([...dockingList])
}} />
}
]
/**
* @description: 删除明细 * @description: 删除明细
* @param {type} * @param {type}
* @return {type} * @return {type}
...@@ -686,8 +551,6 @@ const Detail: React.FC<{}> = () => { ...@@ -686,8 +551,6 @@ const Detail: React.FC<{}> = () => {
case 2: case 2:
setVisibleChannelMember(true) setVisibleChannelMember(true)
break; break;
case 3:
break;
} }
} }
...@@ -721,7 +584,7 @@ const Detail: React.FC<{}> = () => { ...@@ -721,7 +584,7 @@ const Detail: React.FC<{}> = () => {
setproductSource([...data]) setproductSource([...data])
} }
}) })
//商品列表 //商品列表 为动态列渲染做
// PublicApi.getOrderRequisitionFormProductAll({ id: id }).then(res => { // PublicApi.getOrderRequisitionFormProductAll({ id: id }).then(res => {
// if (res.code === 1000) { // if (res.code === 1000) {
// let { data } = res // let { data } = res
...@@ -811,14 +674,7 @@ const Detail: React.FC<{}> = () => { ...@@ -811,14 +674,7 @@ const Detail: React.FC<{}> = () => {
} }
const changePlatform = (e: any) => {
console.log('e',e.target.value)
setplatType(e.target.value)
if (e.target.value == 2) {
//调用需求单
InitMemberList()
}
}
const handleMemberTypeChange = (e: any) => { const handleMemberTypeChange = (e: any) => {
setmemberType(e.target.value) setmemberType(e.target.value)
...@@ -881,16 +737,9 @@ const Detail: React.FC<{}> = () => { ...@@ -881,16 +737,9 @@ const Detail: React.FC<{}> = () => {
*/ */
const handleSubmitTabForm = () => { const handleSubmitTabForm = () => {
tabForm.validateFields().then(values => { tabForm.validateFields().then(values => {
console.log('valiue', values) console.log('valiue', values)
values['requisitionFormId'] = requisitionFormId values['requisitionFormId'] = requisitionFormId
if(id){ values['demandMembers'] = getAuth().name || ''
}else{
}
let productList = [] let productList = []
productSource.forEach((v) => { productSource.forEach((v) => {
let item: any = {} let item: any = {}
...@@ -920,7 +769,6 @@ const Detail: React.FC<{}> = () => { ...@@ -920,7 +769,6 @@ const Detail: React.FC<{}> = () => {
console.log('item', item) console.log('item', item)
}) })
values['quoteDetailss'] = [...productList] values['quoteDetailss'] = [...productList]
console.log('valse',values)
console.log('valse',JSON.stringify(values)) console.log('valse',JSON.stringify(values))
if (id) {//修改 if (id) {//修改
values['id'] = id values['id'] = id
...@@ -1081,6 +929,7 @@ const Detail: React.FC<{}> = () => { ...@@ -1081,6 +929,7 @@ const Detail: React.FC<{}> = () => {
* @return {type} * @return {type}
*/ */
const getOrderProductAll = (id) => { const getOrderProductAll = (id) => {
setrequisitionFormId(id)//需求id
PublicApi.getOrderRequisitionFormProductAll({id:id}).then(res => { PublicApi.getOrderRequisitionFormProductAll({id:id}).then(res => {
if(res.code === 1000){ if(res.code === 1000){
let {data} = res || {} let {data} = res || {}
...@@ -1117,7 +966,7 @@ const Detail: React.FC<{}> = () => { ...@@ -1117,7 +966,7 @@ const Detail: React.FC<{}> = () => {
colon={false} colon={false}
labelAlign="left" labelAlign="left"
autoComplete="off" autoComplete="off"
onFinish={onFinish} // onFinish={onFinish}
initialValues={{ initialValues={{
customerCategoryId: customerCategoryId, customerCategoryId: customerCategoryId,
requisitionFormAddress: requisitionFormAddress requisitionFormAddress: requisitionFormAddress
...@@ -1312,24 +1161,8 @@ const Detail: React.FC<{}> = () => { ...@@ -1312,24 +1161,8 @@ const Detail: React.FC<{}> = () => {
> >
</RroductModal> </RroductModal>
{/* 选择需求单 */}
<InquiryModalTable confirmModal={(val) => confirmModal(val)} currentRef={inquiryRef} schemaAction={addSchemaAction}/> <InquiryModalTable confirmModal={(val) => confirmModal(val)} currentRef={inquiryRef} schemaAction={addSchemaAction}/>
{/* <ModalTable
modalTitle='选择需求单'
confirm={handleOkAddEq}
cancel={() => setdialogEqvisble(false)}
visible={dialogEqvisble}
columns={dialogEqcolumns}
rowSelection={eqRowSelection}
fetchTableData={params => fetchEqData(params)}
formilyProps={
{
ctx: { schema: dialogEqformSearch }
}
}
tableProps={{
rowKey: 'id'
/> */}
<ModalTable <ModalTable
modalTitle='选择会员' modalTitle='选择会员'
confirm={handleOkAddMember} confirm={handleOkAddMember}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:11 * @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com * @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-15 14:11:15 * @LastEditTime: 2020-09-16 16:14:31
*/ */
import React, { ReactNode, useRef, useState,useEffect } from 'react'; import React, { ReactNode, useRef, useState,useEffect } from 'react';
import { history } from 'umi'; import { history } from 'umi';
...@@ -132,7 +132,7 @@ const List:React.FC<{}> = () => { ...@@ -132,7 +132,7 @@ const List:React.FC<{}> = () => {
) )
} }
{ {
(record.externalState === 1 && record.interiorState === 1) && (record.interiorState === 1) &&
<> <>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete([record.id])}> <Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete([record.id])}>
<Button type='link'> <Button type='link'>
......
import { useBusinessEffects } from './useBusinessEffects';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { PublicApi } from '@/services/api';
// 获取单据类型
const fetchInvoicesType = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getWarehouseInvoicesTypeAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
// 获取仓库
const fetchInventory = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getWarehouseWarehouseAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
export const createEffects = (context, actions) => {
useBusinessEffects(context, actions);
useAsyncSelect('invoicesTypeId', fetchInvoicesType, ['name', 'id']);
useAsyncSelect('inventoryId', fetchInventory, ['name', 'id']);
};
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { Button, Card } from 'antd';
import { PublicApi } from '@/services/api';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import { getBillsDetailSchema, orderBillSchema } from './schema';
import { createEffects } from './effects';
const addSchemaAction = createFormActions();
const {
onFieldValueChange$,
onFieldInputChange$,
} = FormEffectHooks;
const AddBills: React.FC<{}> = (props: any) => {
const { pageStatus, preview, id } = usePageStatus();
const [relevance, setRelevance] = useState(1);
const [modalColumns, setModalColumns] = useState([]);
const tableColumns = [
{ dataIndex: 'id', title: 'ID' },
{
dataIndex: 'no',
title: '货号',
render: (text, record) => <span>{text}</span>,
},
{ dataIndex: 'pname', title: '货品名称' },
{ dataIndex: 'size', title: '规格/型号' },
{ dataIndex: 'type', title: '品类' },
{ dataIndex: 'brand', title: '品牌' },
{ dataIndex: 'unit', title: '单位' },
{ dataIndex: 'name', title: '商品名称' },
{ dataIndex: 'univalence', title: '单价' },
{ dataIndex: 'numberr', title: '单据数量' },
{ dataIndex: 'price', title: '金额' },
{
dataIndex: 'ctl',
title: '操作',
render: (text, record) => (
<Button type="link" onClick={() => handleDeleteTable(record.id)}>
删除
</Button>
),
},
];
// 弹出单据明细
const handleAddMemberBtn = () => {};
// 删除选中单据明细
const handleDeleteTable = id => {};
const tableAddButton = (
<Button
style={{ marginBottom: 16 }}
block
icon={<PlusOutlined />}
onClick={handleAddMemberBtn}
type="dashed"
>
添加单据明细
</Button>
);
useEffect(() => {
}, []);
const handleSubmit = value => {
if (pageStatus === 0)
return PublicApi.postWarehouseInvoicesAdd({ ...value }).then(res => {
if (res.code === 1000) return history.goBack();
});
else
return PublicApi.postWarehouseInvoicesUpdata({
id: usePageStatus().id,
...value,
}).then(res => {
if (res.code === 1000) return history.goBack();
});
};
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={
pageStatus === 0
? '新建单据'
: pageStatus === 1
? '编辑单据'
: '查看单据'
}
extra={
preview != '1'
? [
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
onClick={() => addSchemaAction.submit()}
>
保存
</Button>,
]
: []
}
>
<Card>
<NiceForm
expressionScope={{
tableColumns,
tableAddButton,
}}
effects={($, actions) => createEffects($, actions)}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={getBillsDetailSchema({
relevance,
modalColumns,
})}
/>
</Card>
</PageHeaderWrapper>
);
};
export default AddBills;
...@@ -4,26 +4,11 @@ import { PublicApi } from '@/services/api'; ...@@ -4,26 +4,11 @@ import { PublicApi } from '@/services/api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'; import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const { onFieldValueChange$ } = FormEffectHooks const { onFieldValueChange$ } = FormEffectHooks
export const useWarehouseSelect = (context: ISchemaFormActions) => { export const createAddContractTemplateEffect = (context: ISchemaFormActions) => {
onFieldValueChange$('warehouseId').subscribe(state => { const fetchListContractTemplateAll = async () => {
// 货品ID const { data } = await PublicApi.getOrderSelectListContractTemplate()
const goodsId = context.getFieldValue('productId') context.setFieldState('contractTemplateId', state => {
const warehouseId = state.value state.contractTemplateLists = data
PublicApi.getWarehouseInventoryByItemNo({
warehouseId,
itemId: goodsId
}).then(res => {
const { data } = res
context.setFieldValue('NO_SUBMIT3', data.inventory)
})
})
}
export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
const fetchWarehouseAll = async () => {
const { data } = await PublicApi.getWarehouseWarehouseAll()
context.setFieldState('warehouseId', state => {
state.warehouseLists = data
}) })
return data.map(v => ({ return data.map(v => ({
value: v.id, value: v.id,
...@@ -31,8 +16,7 @@ export const createAddRepositoryEffect = (context: ISchemaFormActions) => { ...@@ -31,8 +16,7 @@ export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
})) }))
} }
useAsyncSelect('warehouseId', fetchWarehouseAll) useAsyncSelect('contractTemplateId', fetchListContractTemplateAll)
useWarehouseSelect(context)
} }
export const useUnitPreview = (initValue, context) => { export const useUnitPreview = (initValue, context) => {
......
...@@ -13,43 +13,3 @@ ...@@ -13,43 +13,3 @@
cursor: pointer; cursor: pointer;
} }
} }
// 添加仓位
.storeItemRadio{
display: flex;
flex-wrap: wrap;
// width: 320px;
margin: 0 auto;
& label{
width: 320px !important;
height: 48px !important;
line-height: 48px !important;
margin: 8px 0;
margin-right: 24px;
}
}
//仓位调拨
.circleAmount{
width: 160px;
height: 160px;
border: 4px solid #edeef2;
background-color: #fafbfc;
border-radius: 50%;
& p{
height: 160px;
line-height: 160px;
text-align: center;
font-size: 20px;
font-weight: bold;
}
}
//查看仓位
.amount{
font-size:24px;
font-weight:bold;
color:rgba(23,43,77,1);
}
\ No newline at end of file
...@@ -6,7 +6,7 @@ export const useLinkageUtils = () => { ...@@ -6,7 +6,7 @@ export const useLinkageUtils = () => {
setFieldState(path, state => { setFieldState(path, state => {
const componentProps = state.props['x-component-props'] || {} const componentProps = state.props['x-component-props'] || {}
// 对象浅合并 // 对象浅合并
if (key === 'props["x-component-props"]') { if (key === 'props.x-component-props') {
value = Object.assign({}, componentProps, value) value = Object.assign({}, componentProps, value)
} }
FormPath.setIn(state, key, value !== undefined ? value : defaultValue) FormPath.setIn(state, key, value !== undefined ? value : defaultValue)
...@@ -19,6 +19,6 @@ export const useLinkageUtils = () => { ...@@ -19,6 +19,6 @@ export const useLinkageUtils = () => {
loading: linkage('loading', true), loading: linkage('loading', true),
loaded: linkage('loading', false), loaded: linkage('loading', false),
value: linkage('value'), value: linkage('value'),
componentProps: linkage('props["x-component-props"]', {}) componentProps: linkage('props.x-component-props', {})
} }
} }
...@@ -165,10 +165,15 @@ export function omit(obj: any, arr: string[]) { ...@@ -165,10 +165,15 @@ export function omit(obj: any, arr: string[]) {
return tempObj return tempObj
} }
export const findItemAndDelete = (arr: any[], target) => { /**
* @param { Object[] } arr 源数据
* @param { any } target 目标值 通常是id等主键
* @param { string } customKey 可选 自定义主键 默认'id'
*/
export const findItemAndDelete = (arr: any[], target: any, customKey?: string) => {
const newArr = [...arr] const newArr = [...arr]
if (newArr.length > 0 && isObject(newArr[0])) { if (newArr.length > 0 && isObject(newArr[0])) {
return newArr.filter(v => v.id !== target) return newArr.filter(v => v[customKey||'id'] !== target)
} }
const targetIndex = arr.indexOf(target) const targetIndex = arr.indexOf(target)
if (targetIndex === -1) { if (targetIndex === -1) {
......
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