Commit f1839341 authored by GuanHua's avatar GuanHua
parents 98587de9 01c90c71
/*
* @Author: LeeJiancong
* @Date: 2020-07-31 19:56:22
* @LastEditors: LeeJiancong
* @LastEditors: XieZhiXiong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-15 17:18:01
* @LastEditTime: 2020-09-16 15:37:06
*/
const TranactionRoute = {
......@@ -48,7 +48,7 @@ const TranactionRoute = {
path: '/memberCenter/tranactionAbility/stockSellStorage/addBills',
name: 'addBills',
hideInMenu: true,
component: '@/pages/transaction/stockSellStorage/bills/addBills',
component: '@/pages/transaction/stockSellStorage/bills/addBills/index',
},
{
path: '/memberCenter/tranactionAbility/stockSellStorage/inventory',
......
import React, { useState, useEffect, useRef } from 'react';
import { Row, Col, Input, Button, Modal } from 'antd';
import React, { useState, useEffect } from 'react';
import { Input, Button } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import styled from 'styled-components';
import cx from 'classnames';
import { StandardTable } from 'god';
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();
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import ModalTable from '@/components/ModalTable';
const RowStyleLayout = styled(props => <div {...props} />)`
width: 100%;
.relevance {
border-color: #6b778c;
background-color: #6b778c;
border-radius: 0;
}
.ant-input-group-addon {
padding: 0;
}
`;
const data = [
{
key: '1',
role: '采购商',
businessType: '采购',
roleType: '服务消费',
memberType: '企业会员',
},
{
key: '2',
role: '供应商',
businessType: '商品供应',
roleType: '服务提供',
memberType: '企业会员',
const Relevance = props => {
const {
editable,
value = [],
} = props;
const {
modalProps = {
title: '标题',
width: 960,
},
];
selectionType = 'radio',
columns,
formilyProps,
tableProps = {},
fetchTableData,
title = '选择',
} = props.props['x-component-props'];
// 模拟请求
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 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 propsParams = props.props['x-component-props'];
const [rowSelection, rowCtl] = useRowSelectionTable({ type: selectionType });
useEffect(() => {
console.log('props', propsParams);
}, []);
// Table 只能缓存 keys
const rowKeys = value.map(item => item[tableRowKey]);
rowCtl.setSelectedRowKeys(rowKeys);
}, [props.value]);
const handlePreview = () => {
setVisible(!visible);
};
const handleConfirm = () => {
const rows = rowCtl.selectRow;
const keys = rows.map(item => item[tableRowKey]);
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {},
};
const handleSubmit = type => {
if (type === 'confirm') {
} else {
if (props.mutators) {
props.mutators.change(rows);
setVisible(false);
return;
}
rowCtl.setSelectedRowKeys(keys);
setVisible(false);
};
return (
<RowStyleLayout>
<Row>
<Col span={16}>
<Input disabled></Input>
</Col>
<Col span={8}>
<Input
value={
tableRowLableKey ?
value.map(item => item[tableRowLableKey]).join(',') :
'请指明 lableKey 值'
}
addonAfter={(
<>
{editable && (
<Button
type="primary"
className="relevance"
icon={<LinkOutlined />}
onClick={handlePreview}
onClick={() => setVisible(true)}
block
>
关联
{title}
</Button>
</Col>
</Row>
)}
</>
)}
disabled
/>
<Modal
title={propsParams.modalTitle || ''}
<ModalTable
confirm={handleConfirm}
cancel={() => setVisible(false)}
visible={visible}
width={propsParams.modalWidth || ''}
destroyOnClose
onOk={() => handleSubmit('confirm')}
onCancel={() => handleSubmit('cancel')}
>
<StandardTable
columns={propsParams.modalColumns}
currentRef={ref}
tableProps={{ rowKey: 'key' }}
width={960}
{...modalProps}
modalTitle={modalProps.title}
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}
/>
}
columns={columns}
fetchTableData={fetchTableData}
formilyProps={formilyProps}
tableProps={tableProps}
/>
</Modal>
</RowStyleLayout>
);
};
......
......@@ -128,9 +128,10 @@ const SearchSelect = (props: ISchemaFieldComponentProps) => {
filterOption={false}
loading={loading}
options={dataSource}
getPopupContainer={triggerNode => {
return triggerNode
}}
// getPopupContainer={triggerNode => {
// return triggerNode
// }}
getPopupContainer={() => document.getElementById('root')} /* 处理option被遮挡 */
value={props.value}
dropdownRender={originNode => <SelectContent confirm={confirm} resetField={resetField} parentRef={ref} handleChange={handleChange} multiple={multiple} value={props.value}>{originNode}</SelectContent>}
{...multipleProps}
......
......@@ -300,6 +300,13 @@ export const DOC_DIRECTION = {
[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_DEMAND = 2; // 需求采购
......@@ -319,3 +326,7 @@ export const ORDER_TYPE2 = {
[ORDER_TYPE2_CHANNEL_SPOT]: '渠道现货',
[ORDER_TYPE2_CHANNEL_POINTS]: '渠道积分兑换',
};
// 会员角色类型
export const MEMBER_ROLE_TYPE_SERVICE_PROVIDER = 1; // 服务提供者
export const MEMBER_ROLE_TYPE_SERVICE_CONSUMER = 2; // 服务消费者
\ No newline at end of file
......@@ -307,11 +307,40 @@ const DirectChannel: React.FC<{}> = () => {
const handleUpDown = () => {
setIsDisabledOKbtn(true)
let params: any = {
idList: isBatchOption ? selectRow.map(item => item.id) : [currentOptionId],
let params: any = {}
if(isBatchOption){
params = {
idList: selectRow.map(item => item.id),
shopList: checkedValues
}
if(isUp)
}else{
params = {
id: currentOptionId,
shopList: checkedValues
}
}
if(isBatchOption){ // 批量操作区分上下架
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)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}
}else{
if(isUp){
if(checkedValues.length > 0){
PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
setUpDownModal(false)
......@@ -322,12 +351,32 @@ const DirectChannel: React.FC<{}> = () => {
setIsDisabledOKbtn(false)
message.error('请选择需要上架的渠道商城')
}
else
PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
}else{
PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}
}
// if(isUp)
// if(checkedValues.length > 0){
// 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)
// })
}
......
......@@ -237,7 +237,7 @@ export const addChannelSchema: ISchema = {
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
className: 'fixed-ant-selected-down',
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
}
},
......@@ -268,90 +268,4 @@ export const addChannelSchema: 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: {
// 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> = ({
channel = {},
extra = [],
outerHistory = [],
innerHistory = [],
innerHistory,
channelRender,
}) => {
......
......@@ -42,7 +42,7 @@ interface FlowRecordsProps {
innerHistory?: InnerHistoryItem[];
};
const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory = [] }) => {
const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHistory }) => {
const outerColumns: EditableColumns[] = [
{
......@@ -143,6 +143,7 @@ const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHisto
pagination={null}
/>
</Tabs.TabPane>
{innerHistory && (
<Tabs.TabPane tab="内部单据流转记录" key="2">
<PolymericTable
dataSource={innerHistory}
......@@ -151,6 +152,7 @@ const FlowRecords: React.FC<FlowRecordsProps> = ({ outerHistory = [], innerHisto
pagination={null}
/>
</Tabs.TabPane>
)}
</Tabs>
</MellowCard>
);
......
......@@ -25,11 +25,13 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { PublicApi } from '@/services/api';
import { getAuth } from '@/utils/auth';
import {
MEMBER_OUTER_STATUS,
MEMBER_OUTER_STATUS_UNCOMMITTED,
MEMBER_OUTER_STATUS_SUCCESS,
MEMBER_OUTER_STATUS_FAILED,
MEMBER_ROLE_TYPE_SERVICE_PROVIDER,
} from '@/constants';
import StatusTag from '../components/StatusTag';
import { importSchema, auditModalSchema } from './schema';
......@@ -48,6 +50,8 @@ const MemberMaintain: React.FC<[]> = () => {
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [visibleModal, setVisibleModal] = useState(false);
const userInfo = getAuth();
const handleDelete = (memberId: number, validateId: number) => {
const mesInstance = message.loading({
content: '正在删除',
......@@ -258,6 +262,8 @@ const MemberMaintain: React.FC<[]> = () => {
const controllerBtns = (
<Space>
{userInfo.memberRoleType === MEMBER_ROLE_TYPE_SERVICE_PROVIDER && (
<>
<Button
type="primary"
onClick={() =>
......@@ -275,6 +281,8 @@ const MemberMaintain: React.FC<[]> = () => {
>
更多
</Dropdown.Button>
</>
)}
</Space>
);
......
import React from 'react';
import { Steps } from 'antd';
import { observer, inject } from 'mobx-react';
import { IMemberModule } from '@/module/memberModule';
import MellowCard from '@/components/MellowCard';
import BasicInfo from '../../components/BasicInfo';
const MemberBasicInfo: React.FC<{}> = () => {
interface MemberBasicInfoProps {
MemberStore?: IMemberModule;
};
const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({
MemberStore,
}) => {
const { memberMaintainInfo } = MemberStore;
return (
<div>
<MellowCard
......@@ -12,16 +22,32 @@ const MemberBasicInfo: React.FC<{}> = () => {
marginBottom: 24,
}}
>
<Steps style={{ marginTop: 30 }} progressDot current={2}>
<Steps.Step title="业务角色" description="申请审核" />
<Steps.Step title="业务角色" description="审核会员" />
<Steps.Step title="完成" description="" />
<Steps style={{ marginTop: 30 }} progressDot current={memberMaintainInfo?.currentOuterStep}>
{memberMaintainInfo.outerVerifySteps ? memberMaintainInfo.outerVerifySteps.map((item, index) => (
<Steps.Step key={index} title={item.roleName} description={item.stepName} />
)) : null}
</Steps>
</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>
);
};
export default MemberBasicInfo;
\ No newline at end of file
export default inject('MemberStore')(observer(MemberBasicInfo));
\ No newline at end of file
......@@ -3,10 +3,10 @@
* @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-10 11:42:28
* @LastEditTime: 2020-09-16 16:28:24
*/
/**
* @description: 组件描述: 一级 二级 待提交需求
* @description: 组件描述: 一级 二级 待提交报价
* @param {type}
* @return {type}
*/
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @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 { Modal, Button,Space, Form, Radio, AutoComplete, Badge,Tabs, Input, Select, Checkbox } from 'antd'
......@@ -120,7 +120,7 @@ const columns: ColumnType<any>[] = [
const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
// const {onRef} = props
// const cRef = props.currentRef
console.log('数据',props)
// console.log('数据',props)
const [visible, setsVisible] = useState(false) //state hook写法
......@@ -152,7 +152,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
}
const handleSelectOk = () => {
console.log('数据', productRowCtl);
const selectRow = productRowCtl.selectRow[0]
let { commodityId, id,customerCategoryName, goodsId, roleId, name, brandName } = selectRow
Curform.setFieldsValue({
......@@ -191,7 +190,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
*/
const handletOk = () => {
Curform.validateFields().then(v => {
console.log('表单', v)
props.onOK(v,commodityAttributedataSource)
props.productAttributeJson(commodityAttributedataSource)
Curform.resetFields()
......@@ -202,7 +200,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
// onRef(inRef)
if( id && props.mode == 0){//新增重置
console.log(31212)
Curform.setFieldsValue({
model:'',
productId:'',
......@@ -214,7 +211,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
}
}, [])
useEffect(() => {
console.log('重置',props.mode)
if(props.initialValues && props.initialValues.productId){
GetCommodityAttribute(props.initialValues.productId)
}
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:29
* @LastEditors: LeeJiancong
* @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 ReactDOM from 'react-dom'
......@@ -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: 生产商品动态弹窗
* @param {type} seletCategoryId品类id needotherCoumns 需要展示动态列
* @return {type}
......@@ -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: 删除明细
* @param {type}
* @return {type}
......@@ -686,8 +551,6 @@ const Detail: React.FC<{}> = () => {
case 2:
setVisibleChannelMember(true)
break;
case 3:
break;
}
}
......@@ -721,7 +584,7 @@ const Detail: React.FC<{}> = () => {
setproductSource([...data])
}
})
//商品列表
//商品列表 为动态列渲染做
// PublicApi.getOrderRequisitionFormProductAll({ id: id }).then(res => {
// if (res.code === 1000) {
// let { data } = res
......@@ -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) => {
setmemberType(e.target.value)
......@@ -882,15 +738,8 @@ const Detail: React.FC<{}> = () => {
const handleSubmitTabForm = () => {
tabForm.validateFields().then(values => {
console.log('valiue', values)
values['requisitionFormId'] = requisitionFormId
if(id){
}else{
}
values['demandMembers'] = getAuth().name || ''
let productList = []
productSource.forEach((v) => {
let item: any = {}
......@@ -920,7 +769,6 @@ const Detail: React.FC<{}> = () => {
console.log('item', item)
})
values['quoteDetailss'] = [...productList]
console.log('valse',values)
console.log('valse',JSON.stringify(values))
if (id) {//修改
values['id'] = id
......@@ -1081,6 +929,7 @@ const Detail: React.FC<{}> = () => {
* @return {type}
*/
const getOrderProductAll = (id) => {
setrequisitionFormId(id)//需求id
PublicApi.getOrderRequisitionFormProductAll({id:id}).then(res => {
if(res.code === 1000){
let {data} = res || {}
......@@ -1117,7 +966,7 @@ const Detail: React.FC<{}> = () => {
colon={false}
labelAlign="left"
autoComplete="off"
onFinish={onFinish}
// onFinish={onFinish}
initialValues={{
customerCategoryId: customerCategoryId,
requisitionFormAddress: requisitionFormAddress
......@@ -1312,24 +1161,8 @@ const Detail: React.FC<{}> = () => {
>
</RroductModal>
{/* 选择需求单 */}
<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
modalTitle='选择会员'
confirm={handleOkAddMember}
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong
* @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 { history } from 'umi';
......@@ -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])}>
<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';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const { onFieldValueChange$ } = FormEffectHooks
export const useWarehouseSelect = (context: ISchemaFormActions) => {
onFieldValueChange$('warehouseId').subscribe(state => {
// 货品ID
const goodsId = context.getFieldValue('productId')
const warehouseId = state.value
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
export const createAddContractTemplateEffect = (context: ISchemaFormActions) => {
const fetchListContractTemplateAll = async () => {
const { data } = await PublicApi.getOrderSelectListContractTemplate()
context.setFieldState('contractTemplateId', state => {
state.contractTemplateLists = data
})
return data.map(v => ({
value: v.id,
......@@ -31,8 +16,7 @@ export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
}))
}
useAsyncSelect('warehouseId', fetchWarehouseAll)
useWarehouseSelect(context)
useAsyncSelect('contractTemplateId', fetchListContractTemplateAll)
}
export const useUnitPreview = (initValue, context) => {
......
......@@ -13,43 +13,3 @@
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 = () => {
setFieldState(path, state => {
const componentProps = state.props['x-component-props'] || {}
// 对象浅合并
if (key === 'props["x-component-props"]') {
if (key === 'props.x-component-props') {
value = Object.assign({}, componentProps, value)
}
FormPath.setIn(state, key, value !== undefined ? value : defaultValue)
......@@ -19,6 +19,6 @@ export const useLinkageUtils = () => {
loading: linkage('loading', true),
loaded: linkage('loading', false),
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[]) {
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]
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)
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