Commit 61354f81 authored by xiexiuxing's avatar xiexiuxing

合并到本地

parents ee092323 ab1f6edc
......@@ -34,7 +34,8 @@ const homeRoute = {
key: 'home',
component: '@/pages/home',
};
const routes = isDev ? [ homeRoute, OrderRoute ] : asyncRoutes;
// isDev ? [ homeRoute, OrderRoute ] :
const routes = asyncRoutes;
// const routes = isDev ? [ CommodityRoute ] : asyncRoutes;
const memberCenterRoute = {
......
......@@ -614,6 +614,7 @@ export default {
'purchaseRequisition.qingshuruqinggouDigest': '请输入请购单摘要',
'purchaseRequisition.qingshurugongying': '请输入供应会员名称',
'purchaseRequisition.qingshuruqinggouDepartment': '请输入请购部门',
'purchaseRequisition.qingshuruqinggouPenson': '请输入请购人',
'purchaseRequisition.qingshuruqinggouUse': '请输入请购用途',
'purchaseRequisition.qingxuanzeneibu': '请选择内部状态',
'purchaseRequisition.kaishishijian': '开始时间',
......
......@@ -67,6 +67,18 @@ export const tableSearchListSchema: any = (align?: String, colStyle?: Object) =>
placeholder: intl.formatMessage({ id: 'purchaseRequisition.qingshuruqinggouDepartment', defaultMessage: '请输入请购部门' })
}
},
"qinggouPenson": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'purchaseRequisition.qingshuruqinggouPenson', defaultMessage: '请输入请购人' }),
showSearch: true,
// defaultActiveFirstOption: false,
// showArrow: false,
// filterOption: false,
onSearch: '{{handleSearch}}'
},
enum: []
},
"purpose": {
type: 'string',
"x-component-props": {
......@@ -146,6 +158,18 @@ export const tableListSchema: any = (align?: String, colStyle?: Object) => {
placeholder: intl.formatMessage({ id: 'purchaseRequisition.qingshuruqinggouDepartment', defaultMessage: '请输入请购部门' })
}
},
"qinggouPenson": {
type: 'string',
"x-component-props": {
placeholder: intl.formatMessage({ id: 'purchaseRequisition.qingshuruqinggouPenson', defaultMessage: '请输入请购人' }),
showSearch: true,
// defaultActiveFirstOption: false,
// showArrow: false,
// filterOption: false,
onSearch: '{{handleSearch}}'
},
enum: []
},
"purpose": {
type: 'string',
"x-component-props": {
......
import React, { useRef, useState } from 'react'
import { Card } from 'antd'
import React, { useRef, useState } from 'react';
import { Card } from 'antd';
import StandardTable from '@/components/StandardTable';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { baseOrderListColumns, tableSearchListSchema } from './constant'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import Submit from '@/components/NiceForm/components/Submit'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
import ModalForm from '@/components/ModalForm'
import { useHttpRequest } from '@/hooks/useHttpRequest'
import TableOperation from '@/components/TableOperation'
import { getPurchaseRequisitionPage, postPurchaseRequisitionCancel, postPurchaseRequisitionPause } from '@/services/PurchaseV2Api'
import { useIntl } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { baseOrderListColumns, tableSearchListSchema } from './constant';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix';
import Submit from '@/components/NiceForm/components/Submit';
import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
import ModalForm from '@/components/ModalForm';
import { useHttpRequest } from '@/hooks/useHttpRequest';
import TableOperation from '@/components/TableOperation';
import {
getPurchaseRequisitionPage,
postPurchaseRequisitionCancel,
postPurchaseRequisitionPause,
} from '@/services/PurchaseV2Api';
import { useIntl } from 'umi';
// 请购单查询
export interface RequestBillProps { }
export interface RequestBillProps {}
const fetchTableData = async (params) => {
const { data } = await getPurchaseRequisitionPage(params)
return data
}
const fetchTableData = async params => {
const { data } = await getPurchaseRequisitionPage(params);
return data;
};
const formActions = createFormActions();
const destroyActions = createFormActions();
const pauseActions = createFormActions();
const RequestBill: React.FC<RequestBillProps> = () => {
const intl = useIntl()
const ref = useRef<any>({})
const destoryRef = useRef<any>({})
const pauseRef = useRef<any>({})
const [curentId, setCurrentId] = useState<number>()
const intl = useIntl();
const ref = useRef<any>({});
const destoryRef = useRef<any>({});
const pauseRef = useRef<any>({});
const [curentId, setCurrentId] = useState<number>();
const { run, loading } = useHttpRequest(postPurchaseRequisitionCancel)
const { run: runPause, loading: loadingEnd } = useHttpRequest(postPurchaseRequisitionPause)
const fetchParams = useRef<any>({})
const { run, loading } = useHttpRequest(postPurchaseRequisitionCancel);
const { run: runPause, loading: loadingEnd } = useHttpRequest(
postPurchaseRequisitionPause,
);
const fetchParams = useRef<any>({});
const loadingTableData = (params) => {
fetchParams.current = {...params}
return fetchTableData(params)
}
const loadingTableData = params => {
fetchParams.current = { ...params };
return fetchTableData(params);
};
// 提交取消
const handleSubmit = () => {
destroyActions.submit().then(async ({values}: any) => {
const result = await run({ ...values, id: curentId })
destroyActions.submit().then(async ({ values }: any) => {
const result = await run({ ...values, id: curentId });
if (result.code === 1000) {
destroyActions.reset()
destoryRef.current.setVisible(false)
destroyActions.reset();
destoryRef.current.setVisible(false);
setTimeout(() => {
ref.current.reload()
}, 800)
ref.current.reload();
}, 800);
}
})
}
});
};
// 提交中止
const handleSubmitPause = () => {
pauseActions.submit().then(async ({values}: any) => {
const result = await runPause({ ...values, id: curentId })
pauseActions.submit().then(async ({ values }: any) => {
const result = await runPause({ ...values, id: curentId });
if (result.code === 1000) {
pauseRef.current.setVisible(false)
pauseRef.current.setVisible(false);
setTimeout(() => {
ref.current.reload()
}, 800)
ref.current.reload();
}, 800);
}
})
}
});
};
const handleCancel = (r) => {
destoryRef.current.setVisible(true)
setCurrentId(r.id)
const handleCancel = r => {
destoryRef.current.setVisible(true);
setCurrentId(r.id);
// destroyActions.setFieldValue('id', r.id)
}
};
const handleSuspend = (r) => {
pauseRef.current.setVisible(true)
setCurrentId(r.id)
const handleSuspend = r => {
pauseRef.current.setVisible(true);
setCurrentId(r.id);
// pauseActions.setFieldValue('id', r.id)
}
};
/** 参照后台数据生成 */
const renderOptionButton = (record) => {
const renderOptionButton = record => {
const buttonGroup = {
[intl.formatMessage({ id: 'purchaseRequisition.quxiaodingdan', defaultMessage: '取消订单' })]: record.showCancel,
[intl.formatMessage({ id: 'purchaseRequisition.zhongzhi', defaultMessage: '中止' })]: record.showPause
}
[intl.formatMessage({
id: 'purchaseRequisition.quxiaodingdan',
defaultMessage: '取消订单',
})]: record.showCancel,
[intl.formatMessage({
id: 'purchaseRequisition.zhongzhi',
defaultMessage: '中止',
})]: record.showPause,
};
const operationHandler = {
[intl.formatMessage({ id: 'purchaseRequisition.quxiaodingdan', defaultMessage: '取消订单' })]: () => handleCancel(record),
[intl.formatMessage({ id: 'purchaseRequisition.zhongzhi', defaultMessage: '中止' })]: () => handleSuspend(record),
}
[intl.formatMessage({
id: 'purchaseRequisition.quxiaodingdan',
defaultMessage: '取消订单',
})]: () => handleCancel(record),
[intl.formatMessage({
id: 'purchaseRequisition.zhongzhi',
defaultMessage: '中止',
})]: () => handleSuspend(record),
};
return (
<TableOperation
buttonTextFieldMap={buttonGroup}
operationHandler={operationHandler}
/>
)
}
);
};
const secondColumns = () => {
const alreadyColumns = baseOrderListColumns()
if(alreadyColumns) {
const alreadyColumns = baseOrderListColumns();
if (alreadyColumns) {
return alreadyColumns.concat([
{
title: intl.formatMessage({ id: 'purchaseRequisition.caozuo', defaultMessage: '操作' }),
title: intl.formatMessage({
id: 'purchaseRequisition.caozuo',
defaultMessage: '操作',
}),
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => renderOptionButton(record)
}
])
render: (text, record) => renderOptionButton(record),
},
]);
}
}
return <PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => loadingTableData(params)}
columns={secondColumns()}
currentRef={ref}
rowKey="id"
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'requisitionNo',
FORM_FILTER_PATH,
)
}}
schema={tableSearchListSchema()}
components={{
DateRangePickerUnix,
Submit
}}
/>
}
/>
</Card>
{/* 取消原因 */}
<ModalForm
modalTitle={intl.formatMessage({ id: 'purchaseRequisition.quxiaoyuanyin', defaultMessage: '取消原因' })}
currentRef={destoryRef}
confirm={handleSubmit}
actions={destroyActions}
schema={{
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
// id: {
// type: 'number',
// title: '当前id',
// visible: false,
// },
reason: {
type: 'textarea',
"x-component-props": {
rows: 4,
placeholder: intl.formatMessage({ id: 'purchaseRequisition.zaicishuruni', defaultMessage: '在此输入你的原因, 最多50个汉字' })
},
title: intl.formatMessage({ id: 'purchaseRequisition.quxiaoyuanyin', defaultMessage: '取消原因' }),
"x-rules": [
{
required: true,
message: intl.formatMessage({ id: 'purchaseRequisition.qingshuruquxiao', defaultMessage: '请输入取消原因' })
},
{
limitByte: true,
maxByte: 100
}
]
}
}
};
const handleSearch = value => {
if (!value) {
formActions.setFieldState('qinggouPenson', fieldState => {
fieldState.props.enum = [];
});
return;
}
};
return (
<PageHeaderWrapper>
<Card>
<StandardTable
fetchTableData={params => loadingTableData(params)}
columns={secondColumns()}
currentRef={ref}
rowKey="id"
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'requisitionNo',
FORM_FILTER_PATH,
);
}}
expressionScope={{
handleSearch,
}}
schema={tableSearchListSchema()}
components={{
DateRangePickerUnix,
Submit,
}}
/>
}
}
}}
modalProps={{confirmLoading: loading}}
/>
{/* 中止原因 */}
<ModalForm
modalTitle={intl.formatMessage({ id: 'purchaseRequisition.zhongzhiyuanyin', defaultMessage: '中止原因' })}
currentRef={pauseRef}
confirm={handleSubmitPause}
actions={pauseActions}
schema={{
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
// id: {
// type: 'number',
// title: '当前id',
// visible: false,
// },
reason: {
type: 'textarea',
"x-component-props": {
rows: 4,
placeholder: intl.formatMessage({ id: 'purchaseRequisition.zaicishuruni', defaultMessage: '在此输入你的原因, 最多50个汉字' })
/>
</Card>
{/* 取消原因 */}
<ModalForm
modalTitle={intl.formatMessage({
id: 'purchaseRequisition.quxiaoyuanyin',
defaultMessage: '取消原因',
})}
currentRef={destoryRef}
confirm={handleSubmit}
actions={destroyActions}
schema={{
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
// id: {
// type: 'number',
// title: '当前id',
// visible: false,
// },
reason: {
type: 'textarea',
'x-component-props': {
rows: 4,
placeholder: intl.formatMessage({
id: 'purchaseRequisition.zaicishuruni',
defaultMessage: '在此输入你的原因, 最多50个汉字',
}),
},
title: intl.formatMessage({
id: 'purchaseRequisition.quxiaoyuanyin',
defaultMessage: '取消原因',
}),
'x-rules': [
{
required: true,
message: intl.formatMessage({
id: 'purchaseRequisition.qingshuruquxiao',
defaultMessage: '请输入取消原因',
}),
},
{
limitByte: true,
maxByte: 100,
},
],
},
title: intl.formatMessage({ id: 'purchaseRequisition.zhongzhiyuanyin', defaultMessage: '中止原因' }),
"x-rules": [
{
required: true,
message: intl.formatMessage({ id: 'purchaseRequisition.qingshuruquxiao', defaultMessage: '请输入取消原因' })
},
},
},
}}
modalProps={{ confirmLoading: loading }}
/>
{/* 中止原因 */}
<ModalForm
modalTitle={intl.formatMessage({
id: 'purchaseRequisition.zhongzhiyuanyin',
defaultMessage: '中止原因',
})}
currentRef={pauseRef}
confirm={handleSubmitPause}
actions={pauseActions}
schema={{
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
// id: {
// type: 'number',
// title: '当前id',
// visible: false,
// },
reason: {
type: 'textarea',
'x-component-props': {
rows: 4,
placeholder: intl.formatMessage({
id: 'purchaseRequisition.zaicishuruni',
defaultMessage: '在此输入你的原因, 最多50个汉字',
}),
},
{
limitByte: true,
maxByte: 100
}
]
}
}
}
}
}}
modalProps={{confirmLoading: loadingEnd}}
/>
</PageHeaderWrapper>
}
title: intl.formatMessage({
id: 'purchaseRequisition.zhongzhiyuanyin',
defaultMessage: '中止原因',
}),
'x-rules': [
{
required: true,
message: intl.formatMessage({
id: 'purchaseRequisition.qingshuruquxiao',
defaultMessage: '请输入取消原因',
}),
},
{
limitByte: true,
maxByte: 100,
},
],
},
},
},
},
}}
modalProps={{ confirmLoading: loadingEnd }}
/>
</PageHeaderWrapper>
);
};
RequestBill.defaultProps = {}
RequestBill.defaultProps = {};
export default RequestBill
export default RequestBill;
import { getProductSelectGetSelectBrand } from "@/services/ProductV2Api"
export const searchOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
getProductSelectGetSelectBrand({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
......@@ -12,6 +12,8 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import '../index.less'
import { tableListSchema } from '../constant'
import { getPurchaseRequisitionCreatePage } from '@/services/PurchaseV2Api'
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { searchOptionEffect } from './effect';
// 待新增请购单
......@@ -28,6 +30,15 @@ const ReadyAddBill:React.FC<ReadyAddBillProps> = () => {
const clickAdd = () => {
history.push(`/memberCenter/procurementAbility/purchaseRequisition/readyAddBill/add`)
}
const formActions = createFormActions();
const handleSearch = value => {
if (!value) {
formActions.setFieldState('qinggouPenson', fieldState => {
fieldState.props.enum = [];
});
return;
}
};
return <PageHeaderWrapper>
<Card>
......@@ -50,6 +61,9 @@ const ReadyAddBill:React.FC<ReadyAddBillProps> = () => {
'requisitionNo',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('brandId').subscribe(state => {
searchOptionEffect(actions, 'brandId')
})
},
components: {
DateRangePickerUnix,
......
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