Commit 31463f28 authored by xiexiuxing's avatar xiexiuxing

曾加新字段,请购单改

parent 612acd98
......@@ -65,7 +65,6 @@ const TableOperation: React.FC<TableOperationProps> = (props) => {
:
keyNames.map((item, i) => (buttonTextFieldMap[item] ?
// <div>{buttonPermissionsMap[item]}</div>
<AuthButton btnCode={buttonPermissionsMap[item]} key={`btnItem${i}`}>
<Button type='link' onClick={operationHandler[item]}>{item}</Button>
</AuthButton>
......
......@@ -7,14 +7,17 @@ import TableOperation from '@/components/TableOperation'
// 待审核请购单 一级 Hook
export const useSelfTable = () => {
const ref = useRef<any>({})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({ customKey: 'id' })
const intl = useIntl()
const handleSubmit = (id) => {
history.push(`/memberCenter/procurementAbility/purchaseRequisition/firstApprovedBill/detail?id=${id}`)
}
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = {
'审核': 'DevTest',
}
const buttonGroup = { [intl.formatMessage({ id: 'purchaseRequisition.shenhe', defaultMessage: '审核' })]: true }
const operationHandler = {
......@@ -25,13 +28,14 @@ export const useSelfTable = () => {
<TableOperation
buttonTextFieldMap={buttonGroup}
operationHandler={operationHandler}
buttonPermissionsMap={btnAuthOfOperationTextMap}
/>
)
}
const secondColumns = () => {
const alreadyColumns = baseOrderListColumns()
if(alreadyColumns) {
if (alreadyColumns) {
return alreadyColumns.concat([
{
title: intl.formatMessage({ id: 'purchaseRequisition.caozuo', defaultMessage: '操作' }),
......
......@@ -18,7 +18,7 @@ export const getUnitPriceTotal = (record) => {
export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const materialRef = useRef<any>({})
const intl = useIntl()
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({ type: 'checkbox' })
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('products')]
......@@ -36,18 +36,18 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
const [materialColumns, setMaterialColumns] = useState(() => {
// 渲染操作
materialInfoColumns[materialInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({ id: 'purchaseRequisition.shanchu', defaultMessage: '删除' })}</Button>
materialInfoColumns[materialInfoColumns.length - 2].render = (t, r) => r.amount && <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.amount).toFixed(2)}</span>
materialInfoColumns[materialInfoColumns.length - 2].render = (t, r) => r.amount && <span style={{ color: 'red' }}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency' })} {Number(r.amount).toFixed(2)}</span>
return materialInfoColumns
})
const handleShowMaterial = () => {
const products = ctx.getFieldValue('products')
materialRef.current.setVisible(true)
if(products && products.length) {
if (products && products.length) {
materialRef.current.rowSelectionCtl.setSelectedRowKeys(() => products.map(item => item.id))
}
}
const materialAddButton = <Button onClick={handleShowMaterial} block type='default' style={{margin: '24px auto'}}>{intl.formatMessage({ id: 'purchaseRequisition.xuanzecaigouwu', defaultMessage: '选择采购物料' })}</Button>
const materialAddButton = <Button onClick={handleShowMaterial} block type='default' style={{ margin: '24px auto' }}>{intl.formatMessage({ id: 'purchaseRequisition.xuanzecaigouwu', defaultMessage: '选择采购物料' })}</Button>
const materialComponents = {
body: {
row: MaterialEditableRow,
......@@ -67,7 +67,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
...row,
});
ctx.setFieldValue('products', newData)
resolve({item, newData})
resolve({ item, newData })
})
};
......
......@@ -48,21 +48,7 @@ const basicInfo: ISchema = {
span: 1
}
},
deliverTime: {
type: 'string',
"x-component": 'date',
title: getIntl().formatMessage({ id: 'purchaseRequisition.yujiaoriqi', defaultMessage: '预交日期' }),
required: true,
"x-component-props": {
disabledDate: current => {
return current && current < moment().startOf('day')
},
style: { width: '100%' }
},
"x-mega-props": {
span: 1
}
},
department: {
type: 'string',
title: getIntl().formatMessage({ id: 'purchaseRequisition.qinggoubumen', defaultMessage: '请购部门' }),
......@@ -124,12 +110,107 @@ const basicInfo: ISchema = {
title: getIntl().formatMessage({ id: 'purchaseRequisition.neibuzhuangtai', defaultMessage: '内部状态' }),
visible: false
},
deliverTime: {
type: 'string',
title: "请购人",
"x-rules": [
{
required: true,
message:"请输入请购人"
},
{
limitByte: true,
maxByte: 100
}
],
"x-mega-props": {
span: 1
}
},
}
},
}
}
// 送货/交期信息
const delivery: ISchema = {
"x-index": 1,
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: "送货/交期信息",
id: 'delivery',
},
properties: {
NO_SUBMIT_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 6,
wrapperCol: 16,
labelAlign: "left",
grid: true,
full: true,
autoRow: true,
columns: 2,
},
properties: {
deliverTime: {
type: 'string',
"x-component": 'date',
title: getIntl().formatMessage({ id: 'purchaseRequisition.yujiaoriqi', defaultMessage: '预交日期' }),
required: true,
"x-component-props": {
disabledDate: current => {
return current && current < moment().startOf('day')
},
style: { width: '100%' }
},
"x-mega-props": {
span: 1
}
},
purpose: {
type: 'string',
title: "配送方式",
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'purchaseRequisition.qingshuruqinggou', defaultMessage: '请输入配送方式' })
},
{
limitByte: true,
maxByte: 100
}
],
"x-mega-props": {
span: 1
}
},
vendorMemberName: {
type: 'string',
title: "送货地址",
"x-rules": [
{
required: true,
message:"请输入送货地址"
},
{
limitByte: true,
maxByte: 100
}
],
"x-mega-props": {
span: 1
}
},
}
},
}
}
// 请购单物料
const material: ISchema = {
"x-index": 2,
......@@ -158,11 +239,37 @@ const material: ISchema = {
}
}
// 附件
const enclosure: ISchema = {
"x-index": 3,
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: "附件",
id: 'enclosure',
},
properties: {
productsList: {
type: 'array',
"x-component": 'MultTable',
required: true,
"x-component-props": {
rowKey: 'id',
columns: "{{enclosureColumns}}",
suffix: "{{enclosureColumnsButton}}",
},
},
}
}
export const increaseSchema: ISchema = {
type: 'object',
properties: {
basicInfo,
delivery,
material,
enclosure,
}
}
......@@ -21,7 +21,7 @@ import { useIntl } from 'umi';
// 请购单查询
export interface RequestBillProps {}
export interface RequestBillProps { }
const fetchTableData = async params => {
const { data } = await getPurchaseRequisitionPage(params);
......@@ -91,6 +91,11 @@ const RequestBill: React.FC<RequestBillProps> = () => {
/** 参照后台数据生成 */
const renderOptionButton = record => {
const btnAuthOfOperationTextMap = {
'取消订单': 'DevTest',
'中止': 'DevTest',
}
const buttonGroup = {
[intl.formatMessage({
id: 'purchaseRequisition.quxiaodingdan',
......@@ -100,7 +105,7 @@ const RequestBill: React.FC<RequestBillProps> = () => {
id: 'purchaseRequisition.zhongzhi',
defaultMessage: '中止',
})]: record.showPause,
};
}
const operationHandler = {
[intl.formatMessage({
......@@ -117,6 +122,7 @@ const RequestBill: React.FC<RequestBillProps> = () => {
<TableOperation
buttonTextFieldMap={buttonGroup}
operationHandler={operationHandler}
buttonPermissionsMap={btnAuthOfOperationTextMap}
/>
);
};
......
......@@ -17,28 +17,22 @@ import { searchOptionEffect } from './effect';
// 待新增请购单
export interface ReadyAddBillProps {}
export interface ReadyAddBillProps { }
const fetchTableData = async (params) => {
const { data } = await getPurchaseRequisitionCreatePage(params)
return data
}
const ReadyAddBill:React.FC<ReadyAddBillProps> = () => {
const ReadyAddBill: React.FC<ReadyAddBillProps> = () => {
const { columns, ref } = useSelfTable()
const intl = useIntl()
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 +44,7 @@ const ReadyAddBill:React.FC<ReadyAddBillProps> = () => {
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
ctx: {
inline: false,
......@@ -60,11 +55,15 @@ const ReadyAddBill:React.FC<ReadyAddBillProps> = () => {
actions,
'requisitionNo',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('brandId').subscribe(state => {
searchOptionEffect(actions, 'brandId')
})
},
components: {
DateRangePickerUnix,
Submit
......@@ -72,13 +71,13 @@ const ReadyAddBill:React.FC<ReadyAddBillProps> = () => {
},
layouts: {
order: 2,
span: 16
span: 24
}
}}
formilyChilds={{
children: <Space>
<Button
icon={<PlusCircleOutlined/>}
icon={<PlusCircleOutlined />}
type='primary'
onClick={clickAdd}
>
......
......@@ -9,11 +9,11 @@ import { postPurchaseRequisitionDelete, postPurchaseRequisitionSubmitAudit } fro
// 待新增请购单 Hook
export const useSelfTable = () => {
const ref = useRef<any>({})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({ customKey: 'id' })
const intl = useIntl()
const handleSubmit = async (id) => {
await postPurchaseRequisitionSubmitAudit({id})
await postPurchaseRequisitionSubmitAudit({ id })
ref.current.reload()
}
......@@ -21,7 +21,7 @@ export const useSelfTable = () => {
Modal.confirm({
title: intl.formatMessage({ id: 'purchaseRequisition.shifouzhixingshan', defaultMessage: '是否执行删除操作?' }),
onOk: async () => {
await postPurchaseRequisitionDelete({id})
await postPurchaseRequisitionDelete({ id })
ref.current.reload()
}
})
......@@ -31,8 +31,13 @@ export const useSelfTable = () => {
history.push(`/memberCenter/procurementAbility/purchaseRequisition/readyAddBill/edit?id=${record.id}`)
}
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = {
'提交审核': 'DevTest',
'修改': 'DevTest',
'删除': 'DevTest',
}
const buttonGroup = { [intl.formatMessage({ id: 'purchaseRequisition.tijiaoshenhe', defaultMessage: '提交审核' })]: record.showSubmit, [intl.formatMessage({ id: 'purchaseRequisition.xiugai', defaultMessage: '修改' })]: true, [intl.formatMessage({ id: 'purchaseRequisition.shanchu', defaultMessage: '删除' })]: record.showDelete }
const operationHandler = {
......@@ -45,13 +50,14 @@ export const useSelfTable = () => {
<TableOperation
buttonTextFieldMap={buttonGroup}
operationHandler={operationHandler}
buttonPermissionsMap={btnAuthOfOperationTextMap}
/>
)
}
const secondColumns = () => {
const alreadyColumns = baseOrderListColumns()
if(alreadyColumns) {
if (alreadyColumns) {
return alreadyColumns.concat([
{
title: intl.formatMessage({ id: 'purchaseRequisition.caozuo', defaultMessage: '操作' }),
......
......@@ -8,14 +8,17 @@ import TableOperation from '@/components/TableOperation'
export const useSelfTable = () => {
const intl = useIntl()
const ref = useRef<any>({})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({ customKey: 'id' })
const handleSubmit = (id) => {
history.push(`/memberCenter/procurementAbility/purchaseRequisition/secondApprovedBill/detail?id=${id}`)
}
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
const btnAuthOfOperationTextMap = {
'审核': 'DevTest',
}
const buttonGroup = { [intl.formatMessage({ id: 'purchaseRequisition.shenhe', defaultMessage: '审核' })]: true }
const operationHandler = {
......@@ -26,13 +29,14 @@ export const useSelfTable = () => {
<TableOperation
buttonTextFieldMap={buttonGroup}
operationHandler={operationHandler}
buttonPermissionsMap={btnAuthOfOperationTextMap}
/>
)
}
const secondColumns = () => {
const alreadyColumns = baseOrderListColumns()
if(alreadyColumns) {
if (alreadyColumns) {
return alreadyColumns.concat([
{
title: intl.formatMessage({ id: 'purchaseRequisition.caozuo', defaultMessage: '操作' }),
......
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