Commit 8f69f795 authored by alwayOnlie's avatar alwayOnlie

合同

parent 5b890f12
import React, { useState, useRef, ReactNode } from 'react'
import { history, Link } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card, Tabs } from 'antd';
import statuStyle from '../../common/colorTag'
import { ColumnType } from 'antd/lib/table/interface';
import { StandardTable } from 'god';
import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
import {
SaveOutlined,
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import AddInfo from './components/info'
import InfoTable from './components/table'
const formActions = createFormActions();
const { TabPane } = Tabs;
const Add: React.FC<{}> = () => {
const TabList = [
{ name: '基本信息', components: <AddInfo /> },
{ name: '采购物料', components: <InfoTable /> },
]
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
>
<Card>
<Tabs defaultActiveKey="0" type="card" size="small">
{
TabList.map((item, index) => (
<TabPane tab={item.name} key={index}>
{item.components}
</TabPane>
))
}
</Tabs>
</Card>
</PageHeaderWrapper>
)
}
export default Add
.tag {
padding: 10px 15px;
border: 1px solid #E4E6EB;
cursor: pointer;
}
.tative {
padding: 10px 15px;
background: #6B778C;
color: #fff;
cursor: pointer;
}
.point {
width: 10px;
height: 10ox;
background: '#41CC9E';
display: 'inline-block';
border-radius: '50%';
margin-right: 10px;
}
.tag{
padding: 10px 15px;
border: 1px solid #E4E6EB;
cursor:pointer;
}
.tative{
padding: 10px 15px;
background: #6B778C;
color: #fff;
cursor:pointer;
}
.point {
width: 10px;
height: 10ox;
background: '#41CC9E';
display: 'inline-block';
border-radius: '50%';
margin-right: 10px;
}
This diff is collapsed.
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const Schema: any = {
type: 'object',
properties: {
contractNo: {
type: 'string',
"x-component": 'SearchFilter',
'x-component-props': {
placeholder: '请输入搜索合同编号',
align: 'start',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
inline: true,
colStyle: {
marginRight: 20
}
},
properties: {
"contractAbstract": {
type: 'string',
"x-component-props": {
placeholder: '请款单摘要'
}
},
"[startTime,endTime]": {
type: 'array',
"x-component": 'DateRangePickerUnix',
'x-component-props': {
placeholder: ['开始时间', '结束时间'],
format: 'YYYY-MM-DD HH:mm:ss',
// disabledDate: current => {
// console.log(current);
// return current && current < moment().startOf('day')
// }
},
},
"awardName": {
type: 'string',
"x-component-props": {
placeholder: '请输入收款方'
}
},
submit: {
'x-component': 'Submit',
'x-component-props': {
children: '查询',
},
},
},
},
}
}
import React, { useState } from 'react';
import { Button, Table, Input, Space, Typography } from 'antd'
import styles from './index.less'
import {
PlusOutlined
} from '@ant-design/icons'
const { Text } = Typography;
const table: React.FC<{}> = () => {
const tabcolumns: any = [
{
title: '单据号/摘要', dataIndex: 'payNum', align: 'center',
},
{
title: '单据类型', dataIndex: 'payStage', align: 'center',
},
{
title: '单据状态', dataIndex: 'expectPayTime', align: 'center',
},
{
title: '单据时间', dataIndex: 'payRatio', align: 'center',
},
{
dataIndex: 'payAmount', align: 'center',
title: (
<Space direction='vertical'>
<Text>单据金额</Text>
<Text>合计: ¥156.000.00</Text>
</Space>
),
},
{
title: '含税/税率', dataIndex: 'payWay', align: 'left',
},
{
dataIndex: 'payAmount', align: 'center',
title: (
<Space direction='vertical'>
<Text>已付款</Text>
<Text>合计: ¥156.000.00</Text>
</Space>
),
},
{
dataIndex: 'payAmount', align: 'center',
title: (
<Space direction='vertical'>
<Text>已请款待付款</Text>
<Text>合计: ¥156.000.00</Text>
</Space>
),
},
{
dataIndex: 'payAmount', align: 'center',
title: (
<Space direction='vertical'>
<Text>请款金额</Text>
<Text>合计: ¥156.000.00</Text>
</Space>
),
},
{
title: '操作',
dataIndex: '',
align: 'center',
key: 'x',
},
];
const [PlanList, setPlanList] = useState<any>([
{
payNum: '1',
payStage: '',
expectPayTime: '',
payRatio: '',
payAmount: '',
payWay: '1',
payParam: '',
},
]);
return (
<div className="table">
<div style={{ padding: 15, }} >
<Button block type='dashed'><PlusOutlined />选择待请款单据</Button>
</div>
<Table
columns={tabcolumns}
dataSource={PlanList}
rowKey="id"
style={{
width: "100%"
}}
pagination={false}
/>
</div>
)
}
export default table;
This diff is collapsed.
.box {
width: 100%;
}
.box :global .ant-table-expanded-row-level-1 .ant-table-cell {
padding: 0px !important;
background-color: #ffffff;
}
.box :global .ant-btn-primary {
background: #6B778C;
}
.box .listItem {
display: flex;
}
.box .listItem .label {
flex: 0.2;
padding: 0 16px;
background: linear-gradient(270deg, #ffffff 0%, #daf2e7 100%);
}
.box .listItem .text {
padding: 0px 0px;
flex: 1;
}
.box .listItem p {
margin-bottom: 0;
}
.flex {
display: flex;
align-items: center;
justify-content: center;
}
.flex span {
background: #e4e6eb;
padding: 7px 12px;
color: #c0c4cc;
}
.upload_item {
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
}
.upload_item .upload_left {
display: flex;
align-items: center;
color: #303133;
background-color: #fafbfc;
}
.upload_item .upload_left :global .anticon-file-word {
color: #4279df;
font-size: 18px;
margin-right: 8px;
}
.upload_item .upload_right {
color: #00b37a;
cursor: pointer;
}
.upload_item .upload_right :global .anticon-delete {
margin-left: 19px;
color: #c0c4cc;
}
.tagAtive {
padding: 5px 15px;
background: #6B778C;
color: #fff;
}
.tag {
padding: 5px 15px;
border-top: 1px solid #E4E6EB;
border-right: 1px solid #E4E6EB;
border-bottom: 1px solid #E4E6EB;
}
.box {
width: 100%;
:global {
.ant-table-expanded-row-level-1 .ant-table-cell {
padding: 0px !important;
background-color: #ffffff;
}
.ant-btn-primary{
background: #6B778C;
}
}
.listItem {
display: flex;
.label {
flex: 0.2;
padding: 0 16px;
background: linear-gradient(270deg, #ffffff 0%, #daf2e7 100%);
}
.text {
padding: 0px 0px;
flex: 1;
}
p {
margin-bottom: 0;
}
}
}
.flex {
display: flex;
align-items: center;
justify-content: center;
span {
background: #e4e6eb;
padding: 7px 12px;
color: #c0c4cc;
}
}
.upload_item {
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
.upload_left {
display: flex;
align-items: center;
color: #303133;
background-color: #fafbfc;
:global {
.anticon-file-word {
color: #4279df;
font-size: 18px;
margin-right: 8px;
}
}
}
.upload_right {
color: #00b37a;
cursor: pointer;
:global {
.anticon-delete {
margin-left: 19px;
color: #c0c4cc;
}
}
}
}
.tagAtive{
padding: 5px 15px;
background: #6B778C;
color: #fff;
}
.tag{
padding: 5px 15px;
border-top: 1px solid #E4E6EB;
border-right: 1px solid #E4E6EB;
border-bottom: 1px solid #E4E6EB;
}
......@@ -11,6 +11,8 @@ import EyePreview from '@/components/EyePreview';
import { PlusOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api'
const formActions = createFormActions();
import moment from 'moment';
;
const Addbilldetails: React.FC<{}> = () => {
const ref = useRef<any>({});
......@@ -79,45 +81,22 @@ const Addbilldetails: React.FC<{}> = () => {
// 模拟请求
const fetchData = (params?: any) => {
console.log(params)//可以直接打印参数
// contract / apply / amount / pageToBeAdd
params.status = params.status ? params.status : 0;
params.startTime = params.startTime ? moment().format('YYYY-MM-DD') : '';
params.endTime = params.endTime ? moment().format('YYYY-MM-DD') : '';
return new Promise((resolve, reject) => {
let data = {
code: 1000,
data: [
{
id: 1,
No: 'QPTY12',
name: '进口头层黄牛皮荔枝纹采购请款',
time: '2020-10-25 08:49',
NikName: '广州白马皮具交易中心',
PyNo: 'H-13-00001',
totalPrice: '¥100,000.00',
Price: '¥10,000.00',
status: 1,
type: 1,
description: '待提交审核',
},
{
id: 2,
No: 'QPTY12',
name: '进口头层黄牛皮荔枝纹采购请款',
time: '2020-10-25 08:49',
NikName: '广州白马皮具交易中心',
PyNo: 'H-13-00001',
totalPrice: '¥100,000.00',
Price: '¥10,000.00',
status: 1,
type: 1,
description: '待提交审核',
}
]
}
resolve(data)
PublicApi.getContractApplyAmountPageToBeAdd({
...params,
}).then(res => {
resolve(res.data)
})
})
}
const handleJumpAdd = () => {
history.push('/memberCenter/contract/funds/addbill/Add')
};
const Actions = (
......
......@@ -105,7 +105,7 @@ const Bill: React.FC<{}> = () => {
{
record.status != 9 || record.status != 7 || record.status != 8 || record.status != 1 && <span style={{ color: '#00B37A', marginRight: 20, cursor: 'pointer', }} onClick={() => invalid(record.id)}>作废</span>
}
<span style={{ color: '#00B37A', marginRight: 20, cursor: 'pointer', }} onClick={() => history.push(`/memberCenter/contract/funds/bill/details?applyId=${record.id}`)}>查看</span>
<span style={{ color: '#00B37A', marginRight: 20, cursor: 'pointer', }} onClick={() => history.push(`/memberCenter/contract/funds/bill/details?applyId=${record.id}&type=1`)}>查看</span>
</>
)
}
......
import React, { useEffect, useState, useRef } from 'react';
import { Anchor, Radio, Steps, Row, Col, Input, Button, Modal } from 'antd';
import { Anchor, Radio, Steps, Row, Col, Input, Button, message, Modal } from 'antd';
import style from './index.less';
import { ArrowLeftOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview'
import statuStyle from '../../common/colorTag'
import { history } from 'umi';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import Submit from '@/components/NiceForm/components/Submit'
import { FORM_FILTER_PATH } from '@/formSchema/const'
......@@ -22,7 +23,7 @@ const BillDetails = (props: any) => {
const ref = useRef({});
const [currLink, setCurrLink] = useState(activeAnchorClassName)
const [isAllMember, setIsAllMember] = useState(true)
const { location: { query: { applyId } } } = props
const { location: { query: { applyId, type } } } = props
const [tabPane] = useState([
{ id: 'progress', title: '流转进度' },
{ id: 'process', title: '基本流程' },
......@@ -30,8 +31,11 @@ const BillDetails = (props: any) => {
{ id: 'record', title: '流转记录' },
])
const [targetOffset, setTargetOffset] = useState<number | undefined>(undefined);
const [Visible, setIsModalVisible] = useState<boolean>(false)
const [isModalVisible, setIsModalVisible] = useState(false);
const [StepList, setStepList] = useState<any>([]);
const [applyAbstract, setapplyAbstract] = useState('');
const [reason, setDatareason] = useState('');
const [status, setstatus] = useState<any>()
useEffect(() => {
setTargetOffset(window.innerHeight / 6);
}, []);
......@@ -64,21 +68,21 @@ const BillDetails = (props: any) => {
]
const basicInfo = {
col1: [
{ label: '请款单号', extra: basics.applyNo ? basics.applyNo : '' },
{ label: '请款摘要', extra: basics.applyAbstract ? basics.applyAbstract : '' },
{ label: '内部状态', extra: basics.statusName ? basics.statusName : '' },
{ label: '发票编号', extra: basics.innerStatusName ? basics.innerStatusName : '' },
{ label: '开票日期', extra: basics.orderTime ? basics.orderTime : '' },
{ label: '单据时间', extra: basics.orderTime ? basics.orderTime : '' },
{ label: '请款单号', extra: basics.applyNo ? basics.applyNo : '' },
{ label: '请款摘要', extra: basics.applyAbstract ? basics.applyAbstract : '' },
{ label: '内部状态', extra: basics.statusName ? basics.statusName : '' },
{ label: '发票编号', extra: basics.innerStatusName ? basics.innerStatusName : '' },
{ label: '开票日期', extra: basics.orderTime ? basics.orderTime : '' },
{ label: '单据时间', extra: basics.orderTime ? basics.orderTime : '' },
],
col2: [
{ label: '合同编号', extra: basics.contractNo ? basics.contractNo : '' },
{ label: '收款方', extra: basics.payeeMemberName ? basics.payeeMemberName : '' },
{ label: '收款账户', extra: basics.payeeName ? basics.payeeName : '' },
{ label: '银行账号', extra: basics.bankAccount ? basics.bankAccount : '' },
{ label: '开户行', extra: basics.bankDeposit ? basics.bankDeposit : '' },
{ label: '请款备注', extra: basics.remark ? basics.remark : '' },
{ label: '合同编号', extra: basics.contractNo ? basics.contractNo : '' },
{ label: '收款方', extra: basics.payeeMemberName ? basics.payeeMemberName : '' },
{ label: '收款账户', extra: basics.payeeName ? basics.payeeName : '' },
{ label: '银行账号', extra: basics.bankAccount ? basics.bankAccount : '' },
{ label: '开户行', extra: basics.bankDeposit ? basics.bankDeposit : '' },
{ label: '请款备注', extra: basics.remark ? basics.remark : '' },
],
col3: [
{ label: '合同付款阶段:', extra: basics.payStage ? basics.payStage : '' },
......@@ -92,9 +96,41 @@ const BillDetails = (props: any) => {
}
setbasicInfo(basicInfo)
setStepList(taskStepList);
setapplyAbstract(basics.applyAbstract)
setstatus(basics.status)
}
})
}
/* 作废 */
const oninvalid = () => {
let res_data: any = {
applyId,
reason,
}
if (isAllMember) {
const msg = message.loading({
content: '正在操作',
duration: 0,
});
PublicApi.postContractApplyAmountInvalid(res_data).then(res => {
if (res.code === 1000) {
handleCancel()
// ref.current.reload();
}
}).finally(() => {
msg();
})
} else {
handleCancel()
}
}
const setreason = (e) => {
setDatareason(e.target.value);
}
const handleCancel = () => {
setIsModalVisible(!isModalVisible);
};
useEffect(() => {
setTargetOffset(window.innerHeight / 6);
getDetail()
......@@ -168,45 +204,48 @@ const BillDetails = (props: any) => {
dataIndex: 'applyAmount',
align: 'center',
}]
/* 操作人 */
const columnsList: ColumnType<any>[] = [{
title: '序号',
dataIndex: 'No',
align: 'center',
render: (_, item, index) => (
<p>{index + 1}</p>
)
}, {
title: '操作角色',
dataIndex: 'number',
dataIndex: 'operator',
align: 'center',
}, {
title: '部门',
dataIndex: 'memberName',
dataIndex: 'department',
align: 'center',
},
{
title: '职位',
dataIndex: 'time',
dataIndex: 'jobTitle',
align: 'center',
defaultSortOrder: 'descend',
sorter: (a, b) => a.age - b.age,
},
{
title: '状态',
dataIndex: 'Price',
dataIndex: 'statusName',
align: 'center',
},
{
title: '操作',
dataIndex: 'Price',
dataIndex: 'operate',
align: 'center',
},
{
title: '操作时间',
dataIndex: 'Price',
dataIndex: 'operateTime',
align: 'center',
},
{
title: '审核意见',
dataIndex: 'Price',
dataIndex: 'opinion',
align: 'center',
},
......@@ -223,7 +262,17 @@ const BillDetails = (props: any) => {
})
})
}
// 流转记录
const fetListData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getContractApplyAmountPageRecordList({
applyId,
...params
}).then(res => {
resolve(res.data)
})
})
}
const handleIsAllMemberChange = (v: any) => {
setIsAllMember(v.target.value)
}
......@@ -247,6 +296,7 @@ const BillDetails = (props: any) => {
fontSize: '14px',
color: '#909399',
}}
onClick={() => history.goBack()}
/>
<span
style={{
......@@ -256,7 +306,7 @@ const BillDetails = (props: any) => {
marginLeft: '8px',
}}
>
进口头层黄牛皮荔枝纹 | SPTY12
{applyAbstract}
</span>
</div>
......@@ -269,7 +319,10 @@ const BillDetails = (props: any) => {
</div>
</div>
<div>
<Button type="primary" style={{ width: 80, marginRight: 16 }} onClick={() => setIsModalVisible(!Visible)}>单据作废 </Button>
{
type == 1 || status != 9 || status != 7 || status != 8 || status != 1 && <Button type="primary" style={{ width: 80, marginRight: 16 }} onClick={() => setIsModalVisible(!isModalVisible)}>单据作废 </Button>
}
</div>
</Anchor>
<div id='content' className={style.card}>
......@@ -398,7 +451,7 @@ const BillDetails = (props: any) => {
}}
columns={columnsList}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
fetchTableData={(params: any) => fetListData(params)}
formilyProps={{
ctx: {
inline: false,
......@@ -421,15 +474,13 @@ const BillDetails = (props: any) => {
</div>
</div>
</div>
<Modal title="单据作废" visible={Visible} onOk={() => setIsModalVisible(!Visible)} onCancel={() => setIsModalVisible(!Visible)}>
<Radio.Group onChange={handleIsAllMemberChange}>
<Modal title="单据作废" visible={isModalVisible} onCancel={handleCancel} onOk={oninvalid}>
<Radio.Group onChange={handleIsAllMemberChange} defaultValue={isAllMember} value={isAllMember}>
<Radio value={true}>作废</Radio>
<Radio value={false}>不作废</Radio>
</Radio.Group>
<p style={{ padding: 10, margin: 0 }}>单据作废原因 <span style={{ color: 'red' }}>*</span></p>
<TextArea placeholder="在此输入你的原因,最多60个汉字" maxLength={120} />
<TextArea placeholder="在此输入你的原因,最多60个汉字" maxLength={120} onChange={(e) => setreason(e)} />
</Modal>
</div>
)
......
......@@ -8,14 +8,20 @@ import {
PlusOutlined
} from '@ant-design/icons'
import { StandardTable } from 'god';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import styles from '../index.less'
import { goodcolumns } from '../Table'
import { PublicApi } from '@/services/api';
const { Option } = Select;
const { Text } = Typography;
export interface IProps {
fetchdata: any,
currentRef: any,
fromData: any
}
const FormList = (props: any, ref: any) => {
const FormList = (props: any) => {
const { currentRef, fetchdata, sourceType } = props;
const refs = useRef({});
/* 显示模态框 */
const [isModalVisible, setIsModalVisible] = useState(false);
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
......@@ -34,7 +40,7 @@ const FormList = (props: any, ref: any) => {
{
title: '品类', dataIndex: 'customerCategory', align: 'center',
render: (text, item) =>
<p>{item.customerCategory.name ? item.customerCategory.name : ''}</p>
<span>{item.customerCategory.name ? item.customerCategory.name : ''}</span>
},
{
title: '品牌', dataIndex: 'brand', align: 'center',
......@@ -141,6 +147,7 @@ const FormList = (props: any, ref: any) => {
</Popconfirm>
},
];
const setInput = (e, name, idx) => {
let item = [...data];
switch (name) {
......@@ -186,7 +193,6 @@ const FormList = (props: any, ref: any) => {
const getGoodsList = (params) => {
return new Promise(resolve => {
PublicApi.getProductGoodsGetGoodsList(params).then(res => {
console.log(res);
resolve(res.data)
})
})
......@@ -200,6 +206,64 @@ const FormList = (props: any, ref: any) => {
setData(List)
setSelectedRowKeys(RowKeysList)
};
/* 获取物料信息 */
const getList = () => {
let fn;
switch (sourceType) {
case '1':
fn = PublicApi.getPurchaseQuotedPriceProductlistListContract;
break;
}
const parmas = {
id: 47,
memberId: 8,
memberRoleId: 4,
current: '1',
pageSize: '3',
}
fn(parmas).then(res => {
console.log(res);
// setData(res.data.data)
})
}
useEffect(() => {
if (sourceType) {
getList()
}
}, [])
/* 回调出来的数据 */
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
let list = [];
data.map(item => {
list.push({
id: 0,
materielNo: item.code,
materielName: item.name,
type: item.type,
category: item.customerCategory != null ? item.customerCategory.name : '',
brand: item.brand != null ? item.brand.name : '',
unit: item.unitName,
isHasTax: item.isHasTax,
taxRate: item.taxRate,
purchaseCount: item.purchaseCount,
price: Number(item.price),
bidCount: item.bidCount,
bidAmount: item.bidCount && item.price ? Number(item.bidCount) * Number(item.price) : '',
})
})
resolve({
state: true,
name: 'purchaseMaterielList',
data: { list }
})
})
}
})
const handleCancel = () => {
setIsModalVisible(false);
};
......@@ -226,9 +290,12 @@ const FormList = (props: any, ref: any) => {
)
return (
<div className={styles.box}>
<div style={{ paddingTop: 12, paddingBottom: 12, }} onClick={showModal}>
<Button block type='dashed'><PlusOutlined />选择采购物料</Button>
</div>
{
!sourceType && <div style={{ paddingTop: 12, paddingBottom: 12, }} onClick={showModal}>
<Button block type='dashed'><PlusOutlined />选择采购物料</Button>
</div>
}
<Table
rowKey="id"
columns={columnsTab}
......@@ -247,7 +314,7 @@ const FormList = (props: any, ref: any) => {
rowKey: 'id',
}}
columns={goodcolumns}
currentRef={ref}
currentRef={refs}
rowSelection={rowSelectionGood}
fetchTableData={(params: any) => getGoodsList(params)}
......
import React, { useRef, useState, useEffect, useImperativeHandle, forwardRef } from 'react';
import { Button, Card, Tabs, Table, Input, Select, DatePicker, Popconfirm, Form, Checkbox, Drawer, Typography, Modal, InputNumber } from 'antd'
import styles from '../index.less'
import { PublicApi } from '@/services/api';
import {
FileWordFilled,
} from '@ant-design/icons'
const ContractText = (props: any) => {
const { currentRef } = props;
const [TemplatePage, setTemplatePage] = useState<any>([]);
const [Templatel, setTemplatel] = useState<any>({});
const [checkNick, setCheckNick] = useState(true);
/* 第四个tab */
const onCheckboxChange = (e: { target: { checked: boolean } }) => {
setCheckNick(e.target.checked);
};
const getTemplate = (e) => {
PublicApi.getOrderContractTemplateGet({ id: e }).then(res => {
setTemplatel(res.data)
})
}
/* 获取合同详情数据 */
const contractTemplate = () => {
let data: any = {
current: 1,
pageSize: 99
}
PublicApi.getOrderContractTemplatePage(data).then(res => {
console.log(res);
let list = res.data.data.map((item: any) => {
if (item.state != 0) {
return {
label: item.name + item.version,
value: item.id,
id: item.id,
}
}
})
console.log(list);
setTemplatePage(list)
})
}
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
let contractText = {
id: 0,
templateId: Templatel.id,
isUseElectronicContract: checkNick ? 1 : 0,
contractName: Templatel.name,
contractUrl: Templatel.fileExampleUrl
}
resolve(contractText)
})
}
})
useEffect(() => {
contractTemplate();
}, [])
return (
<div
style={{
width: '100%',
}}
>
<Form.Item label="合同模板" labelAlign="left" labelCol={{ span: 2 }}>
<Select
style={{ width: 600 }}
options={TemplatePage}
placeholder="请选择合同模板"
onChange={(e) => getTemplate(e)}
>
</Select>
<Button type='link' >生成合同</Button>
</Form.Item>
{
Object.keys(Templatel).length != 0 &&
<Form.Item label="合同文本" labelAlign="left" labelCol={{ span: 2 }}>
<div className={styles.upload_item} style={{ width: 680 }}>
<div className={styles.upload_left} style={{ width: 600 }}>
<FileWordFilled />
<span>{Templatel.name}</span>
</div>
<Button type='link' >编辑合同</Button>
</div>
</Form.Item>
}
<Form.Item label="电子合同" labelAlign="left" labelCol={{ span: 2 }}>
<Checkbox checked={checkNick} onChange={onCheckboxChange}>
使用电子合同
</Checkbox>
</Form.Item>
</div>
)
}
export default forwardRef(ContractText)
import React, { useRef, useState, useEffect, useImperativeHandle, forwardRef } from 'react';
import { Button, Card, Tabs, Table, Input, Select, DatePicker, Popconfirm, Form, Checkbox, Drawer, Typography, Modal, InputNumber } from 'antd'
import {
PlusOutlined
} from '@ant-design/icons'
import styles from '../index.less'
const { TextArea, Search } = Input
const { Option } = Select;
import moment from 'moment';
const FormList = (props: any) => {
console.log(props)
const { fromData, currentRef, fetchdata } = props;
const [payNumArr, setpayNumArr] = useState<any>([1,])
const [PlanList, setPlanList] = useState<any>([
{
payNum: '1',
payStage: '',
expectPayTime: '',
payRatio: '',
payAmount: '',
payWay: '1',
payParam: '',
id: 0,
},
]);
/* 显示模态框 */
const tabcolumns: any = [
{
title: '付款次数', dataIndex: 'payNum', align: 'center',
render: (_, item, index) => {
const options = [];
for (let i = 0; i < PlanList.length; i++) {
let Index = payNumArr.indexOf(i + 1);
options.push({
value: i + 1,
disabled: Index == -1 ? false : true
});
}
return (
<Select
style={{ width: 200 }}
defaultValue={item.payNum}
options={options}
key='1'
onChange={(e) => onSelectChange(e, 'payNum', index)}
>
</Select>
)
}
},
{
title: '付款阶段', dataIndex: 'payStage', align: 'center',
render: (_, item, index) => <TextArea maxLength={150} rows={1} onChange={(e) => onSelectChange(e, 'payStage', index)} />
},
{
title: '预计付款时间', dataIndex: 'expectPayTime', align: 'center',
render: (_, item, index) => <DatePicker
style={{ width: '100%' }}
format="YYYY-MM-DD"
onChange={(e) => onSelectChange(e, 'expectPayTime', index)}
/>
},
{
title: '付款比例', dataIndex: 'payRatio', align: 'center',
render: (_, item, index) =>
<div className={styles.flex}>
<Input
style={{
width: 150,
}}
placeholder=""
onChange={(e) => onSelectChange(e, 'payRatio', index)}
/>
<span>%</span>
</div>
},
{
title: '付款金额', dataIndex: 'payAmount', align: 'center',
render: (_, item, index) =>
<div className={styles.flex}>
<span></span>
<Input
style={{
width: 130,
}}
placeholder=""
onChange={(e) => onSelectChange(e, 'payAmount', index)}
/>
</div>
},
{
title: '付款方式', dataIndex: 'payWay', align: 'left',
render: (_, item, index) =>
<div
className={styles.select}
>
<Select
style={{ width: 208 }}
onChange={(e) => onSelectChange(e, 'payWay', index)}
defaultValue={item.payWay}
>
<Option value="3" key={3}>现结</Option>
<Option value="1" key={1}>账期:</Option>
<Option value="2" key={2}>月结:</Option>
</Select>
{
item.payWay != 3 &&
<div className={styles.setBox}>
{/* payParam */}
<InputNumber placeholder='' onChange={(e) => onSelectChange(e, 'payParam', index)} width={60} max={31} />
<span>{item.payWay == 2 ? '号' : item.payWay == 1 ? '天' : ''}</span>
</div>
}
</div>
},
{
title: '操作',
dataIndex: '',
align: 'center',
key: 'x',
render: (_, item, index) => <a onClick={() => Delete(item, index)}>删除</a>,
},
];
/* 添加 */
const addtable = () => {
const data = [...PlanList];
data.push(
{
payNum: '',
payStage: '',
expectPayTime: '',
payRatio: '',
payAmount: '',
payWay: '1',
payParam: '',
id: 0,
},
)
console.log(data)
setPlanList(data)
};
/* 删除 */
const Delete = (elm, idx) => {
const dataSource = [...PlanList];
const arr = [...payNumArr]
let List = dataSource.filter((item, index) => index !== idx);
let numberArr = arr.filter((item, index) => elm.payNum !== item);
console.log(numberArr);
setpayNumArr(numberArr)
setPlanList(List)
};
/* 选中设置值 */
const onSelectChange = (e, name, idx) => {
let item = [...PlanList];
let NumArr = [...payNumArr]
console.log(e, name, idx, item);
// return;
switch (name) {
case 'payWay':
item[idx].payWay = e;
break;
case 'payNum':
item[idx].payNum = e;
NumArr.push(e);
break;
case 'expectPayTime':
item[idx].expectPayTime = moment(e).format('YYYY-MM-DD HH:mm:ss');
break;
case 'payStage':
item[idx].payStage = e.target.value;
break;
case 'payRatio':
item[idx].payRatio = e.target.value;
break;
case 'payAmount':
item[idx].payAmount = e.target.value;
break;
case 'payParam':
item[idx].payParam = e;
break;
}
NumArr = Array.from(new Set(NumArr))
setpayNumArr(NumArr)
setPlanList(item)
}
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
PlanList.map(item => {
item.payNum = Number(item.payNum)
item.payRatio = Number(item.payRatio)
item.payAmount = Number(item.payAmount)
item.payWay = Number(item.payWay)
item.payParam = Number(item.payParam)
// 付款方式: 1 - 账期,2 - 月结,3 - 现结
item.payWayName = item.payWay == 1 ? '账期' : item.payWay == 2 ? '月结' : '现结'
})
resolve(PlanList)
})
}
})
return (
<div className="table">
<Table
columns={tabcolumns}
dataSource={PlanList}
rowKey="id"
style={{
width: "100%"
}}
pagination={false}
/>
<div style={{ background: '#F4F5F7' }} onClick={() => addtable()} >
<Button block type='dashed'><PlusOutlined />添加付款计划</Button>
</div>
</div>
)
}
export default forwardRef(FormList)
......@@ -3,7 +3,9 @@ import { Button, Card, Tabs, Form } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import Information from './components/information'
import FormList from './components/FormList'
import Fromtable from './components/fromtable'
import ContractText from './components/contractText'
import { PublicApi } from '@/services/api';
import {
SaveOutlined,
......@@ -13,47 +15,113 @@ import {
const { TabPane } = Tabs;
const Add: React.FC<{}> = (props) => {
const Add: React.FC<{}> = (props: any) => {
const {
location: {
query: {
contractId,
sourceType,
sourceNo,
sourceId,
totalAmount,
partyBMemberId,
partyBName
contractId, // 合同id
sourceType, // 寻源类型
sourceNo, // 单据
sourceId, // 单据id
totalAmount, // 合同总金额
partyBMemberId, // 授标会员id
partyBName, // 授标 会员昵称
memberRoleId // 授标角色id
} } } = props;
const childRef = useRef<any>();
const currentBasic = useRef<any>({});
const purchaseMate = useRef<any>([])
const payPlan = useRef<any>([])
const contractText = useRef<any>({})
console.log(memberRoleId, partyBMemberId)
const [fromData, setData] = useState<any>([]);
/**
* @param name tag标签名
* @param components 显示内容
*/
const [basic, setbasic] = useState<any>({});
const [purchaseMaterielList, setpurchaseMaterielList] = useState<any>({})
const [payPlanList, setpayPlanList] = useState<any>([]);
/* 是否是手工单 */
const [whether, setwhether] = useState<boolean>(false);
const getType = (e) => {
console.log(e, 'lailai1')
setwhether(e)
}
const TabList = [
{ name: '基本信息', components: <Information ref={childRef} fromData={fromData ? fromData : ''} /> },
{ name: '采购物料', components: <FormList ref={childRef} /> },
// { name: '付款计划', components: table() },
// { name: '合同文本', components: FromDom() },
{
name: '基本信息',
components:
<Information
fetchdata={basic}
currentRef={currentBasic}
fromData={fromData ? fromData : ''}
getType={getType}
/>
},
{
name: '采购物料',
components:
<FormList
fetchdata={purchaseMaterielList}
currentRef={purchaseMate}
sourceType={sourceType}
id={sourceId}
memberId={partyBMemberId}
memberRoleId={memberRoleId}
/>
},
{
name: '付款计划',
components:
<Fromtable
fetchdata={payPlanList}
currentRef={payPlan}
/>
},
{ name: '合同文本', components: <ContractText currentRef={contractText} /> },
]
/* 提交*/
const submit = () => {
const data = childRef.current.FormData()
let basicsVO = {
// id: contractId ? contractId : 0,
// contractNo: data.contractNo ? data.contractNo : '',
// sourceType: data.sourceType ? data.sourceType : '',
// startTime: data.startTime ? data.startTime : '',
// endTime: data.endTime ? data.endTime : '',
// // sourceId: data.sourceId ? data.
// sourceId: sourceId ? sourceId : '',
// partyBMemberId: partyBMemberId ? partyBMemberId : '',
/* 提交*/
const submit = async () => {
/* 基本信息 */
const basicsVO = await currentBasic.current.get();
let totalAmount = 0;
if (basicsVO.data.sourceId == undefined || basicsVO.data.sourceId == '') {
delete basicsVO.data.sourceId
}
if (basicsVO.data.sourceNo == undefined || basicsVO.data.sourceNo == '') {
delete basicsVO.data.sourceNo
}
/* 选择物料 */
const purchaseMaterielList = await purchaseMate.current.length != 0 ? await purchaseMate.current.get() : [];
if (purchaseMaterielList.length != 0) {
purchaseMaterielList.data.list.map(item => {
totalAmount += item.bidAmount
})
basicsVO.data.totalAmount = basicsVO.data.totalAmount ? basicsVO.data.totalAmount : totalAmount;
}
/* 付款方式 */
const payPlanList = await payPlan.current.length != 0 ? await payPlan.current.get() : [];
/* 合同管理 */
const contract = await Object.keys(contractText.current).length != 0 ? await contractText.current.get() : {}
console.log(payPlanList, contract)
let param: any = {
basicsVO: basicsVO.data,
purchaseMaterielList: purchaseMaterielList.data.list,
payPlanList: payPlanList,
contractText: contract
}
console.log(basicsVO)
console.log(param)
PublicApi.postContractManageSave(param).then((res => {
console.log('====================================');
console.log(res);
console.log('====================================');
}))
}
useEffect(() => {
setData({
contractId,
......
......@@ -101,7 +101,7 @@ const PurchaseList = () => {
render: (_, record) => {
return (
<div>
<span style={{ color: '#00B37A', cursor: 'pointer', marginRight: 10 }} onClick={() => history.push(`/memberCenter/contract/manage/add/addList/contracAdd?contractId=${record.id}&sourceType=1&sourceId=${record.demandId}&sourceNo=${record.demandNO}&totalAmount=${record.awardAmount}&partyBMemberId=${record.awardMemberId}&partyBName=${record.awardName}`)}>创建采购询价合同</span>
<span style={{ color: '#00B37A', cursor: 'pointer', marginRight: 10 }} onClick={() => history.push(`/memberCenter/contract/manage/add/addList/contracAdd?contractId=${record.id}&sourceType=1&sourceId=${record.demandId}&sourceNo=${record.demandNO}&totalAmount=${record.awardAmount}&partyBMemberId=${record.awardMemberId}&partyBName=${record.awardName}&memberRoleId=${record.awardRoleId}`)}>创建采购询价合同</span>
<span style={{ color: '#00B37A', cursor: 'pointer' }} onClick={() => history.push(`/memberCenter/contract/manage/purchase/details?contractId=${record.id}`)}>查看</span>
</div>
)
......
......@@ -15,7 +15,8 @@ const tokenList = [
{ name: 'Contract', token: 'b1b7ee2d99434fe0f4d89bfa5c6a05e917c297219653a045b8b2ee5415b37e43', categoryIds: [0], }, // 合同能力
// { name: 'Purchase', token: 'a09e2b66e00079df9881fc660eb17db0265e33362c13f03f2003ba81d26f49d8', categoryIds: [0], }, // 采购服务
{ name: 'Purchase', token: 'a09e2b66e00079df9881fc660eb17db0265e33362c13f03f2003ba81d26f49d8', categoryIds: [0], }, // 采购服务
{ name: 'PurchaseV2', token: '84c81ef877863ad4e2c0ebb2c3b3e80f9539420f2fc0828ef33f5159e8423b2c', categoryIds: [0] }, // 采购服务V2
{ name: 'PurchaseV2', token: 'a6eac15ecb4de2b0f1f3226ecb6ab8cbab673e28bf591e4eb6bbfa5852ca7d8e', categoryIds: [0] }, // 采购服务V2
]
const getConfigMap = (tokens) => tokens.map(v => ({
......
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