Commit 847347e8 authored by alwayOnlie's avatar alwayOnlie

删除小写文件

parent 62c2605b
import React, { useState, useEffect, forwardRef } from 'react';
import { Table, Input, Select, Form, Typography } from 'antd'
import styles from '../index.less'
const { Option } = Select;
const { Text } = Typography;
const FormList = (props: any) => {
const { currentRef, purchaseMaterielList } = props;
const [dataList, setData] = useState([])
const columnsTab: any = [
{
title: '物料编号/名称', dataIndex: 'materielName', align: 'center',
render: (text, item) =>
<div>
<p>{item.materielNo}</p>
<p>{text}</p>
</div>
},
{ title: '规格型号', dataIndex: 'type', align: 'center', },
{
title: '品类', dataIndex: 'category', align: 'center',
render: (text, item) =>
<span>{text}</span>
},
{
title: '品牌', dataIndex: 'brand', align: 'center',
render: (text, item) =>
<span>{text}</span>
},
{ title: '单位', dataIndex: 'unit', align: 'center', },
{
title: '采购数量',
dataIndex: 'purchaseCount',
key: 'purchaseCount',
align: 'center',
render: (text, record, index) =>
<Form.Item
name={`isHasTax${index}`}
rules={[{ required: true, message: '请选择' }]}
>
<Input
style={{
width: 120,
}}
placeholder=""
onChange={(e) => setInput(e, 'purchaseCount', index)}
defaultValue={record.purchaseCount}
disabled
/>
</Form.Item>
},
{
title: '含税', dataIndex: 'isHasTax', align: 'center',
render: (text, record, index) =>
<Form.Item
name={`isHasTax${index}`}
initialValue={text + index}
rules={[{ required: true, message: '请选择' }]}
>
<Select
style={{ width: 80 }}
defaultValue={text === 0 || text === 1 ? text.toString() : ''}
onChange={(e) => setInput(e, 'isHasTax', index)}
disabled
>
<Option value="0" key={0}></Option>
<Option value="1" key={1}></Option>
</Select>
</Form.Item>
},
{
title: '税率', dataIndex: 'taxRate', align: 'center',
render: (text: any, record: any, index: number) =>
<Form.Item
name={`taxRate${index}`}
rules={[{ required: true, message: '请输入' }]}
>
<Input
style={{
width: 120,
}}
defaultValue={text}
onChange={(e) => setInput(e, 'taxRate', index)}
addonAfter="%"
disabled
/>
</Form.Item>
},
{
title: '单价(含税)', dataIndex: 'price', align: 'center',
render: (text: any, record: any, index: number) =>
<Form.Item
name={`price${index}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<Input
style={{
width: 120,
}}
onChange={(e) => setInput(e, 'price', index)}
addonBefore="¥"
defaultValue={text}
disabled
/>
</Form.Item>
},
{
title: '授标数量', dataIndex: 'bidCount', align: 'center',
render: (text, record, index) =>
<Form.Item
name={`bidCount${index}`}
rules={[{ required: true, message: '请输入' }]}
>
<Input
style={{
width: 120,
}}
onChange={(e) => setInput(e, 'bidCount', index)}
defaultValue={text ? text : ''}
disabled
/>
</Form.Item>
},
{
title: '金额(含税)',
dataIndex: 'bidAmount',
key: 'bidAmount',
align: 'center',
render: (text: any, record: any) => <Text>¥{record.bidAmount}</Text>
},
];
useEffect(() => {
setData(purchaseMaterielList)
}, [purchaseMaterielList])
/* 回调出来的数据 */
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
let list = [];
dataList.map((item, index) => {
list.push({
id: item.id,
materielNo: item.materielNo,
materielName: item.materielName,
type: item.type,
category: item.category,
brand: item.brand,
unit: item.unit,
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) : '',
associatedMaterielName: item.associatedMaterielName ? item.associatedMaterielName : '',
associatedGoods: item.associatedGoods ? item.associatedGoods : '',
associatedDataId: item.associatedDataId ? item.associatedDataId : '',
associatedMaterielNo: item.associatedMaterielNo ? item.associatedMaterielNo : '',
associatedType: item.associatedType ? item.associatedType : '',
associatedCategory: item.associatedCategory ? item.associatedCategory : '',
associatedBrand: item.associatedBrand ? item.associatedBrand : '',
rowId: index,
})
})
resolve({
state: true,
name: 'purchaseMaterielList',
data: { list }
})
})
}
})
/* 下拉的子元素 */
const listItem = (record) => (
<div className={styles.listItem}>
<div className={styles.label}>
<p>关联</p>
<p>报价商品</p>
</div>
<div className={styles.text}>
<p>商品ID:{record.associatedDataId}</p>
<p>商品名称:{record.associatedMaterielName}</p>
</div>
<div className={styles.text}>
<p>规格:{record.associatedGoods}</p>
<p>品类:{record.associatedCategory}</p>
</div>
<div className={styles.text}>
<p>品牌:{record.brand ? record.associatedBrand : ''}</p>
</div>
</div>
)
/* 设置值 */
const setInput = (e, name, idx) => {
let item: any = [...dataList];
console.log(e)
switch (name) {
case 'isHasTax':
item[idx].isHasTax = e
break;
case 'taxRate':
item[idx].taxRate = e.target.value;
break;
case 'price':
item[idx].price = e.target.value;
break;
case 'bidCount':
item[idx].bidCount = e.target.value;
break;
case 'purchaseCount':
item[idx].purchaseCount = e.target.value;
break;
}
item[idx].bidAmount = item[idx].bidCount && item[idx].price ? Number(item[idx].bidCount) * Number(item[idx].price) : 0;
console.log(item)
setData(item)
}
return (
<div className={styles.box}>
<Table
rowKey="rowId"
dataSource={dataList}
columns={columnsTab}
expandable={{
expandedRowRender: record => listItem(record),
}}
style={{
width: "100%"
}}
/>
</div>
)
}
export default forwardRef(FormList)
import React, { useState, useEffect, forwardRef } from 'react';
import { Button, Select, Form, Checkbox, message, Upload } from 'antd'
import styles from '../index.less'
import { PublicApi } from '@/services/api';
import { UPLOAD_TYPE } from '@/constants'
import {
FileWordFilled,
} from '@ant-design/icons'
const ContractText = (props: any) => {
const { currentRef, ctText, memberId } = 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.getContractContractTemplateGet({ id: e }).then(res => {
setTemplatel(res.data)
})
}
/* 获取合同详情数据 */
const contractTemplate = () => {
let data: any = {
current: 1,
pageSize: 99
}
PublicApi.getContractContractTemplatePage(data).then(res => {
console.log(res);
let list = [];
res.data.data.find((item: any) => {
item.version != null ? item.version : '';
if (item.state == 1) {
list.push({
label: item.name + item.version,
value: item.id,
id: item.id,
})
}
})
setTemplatePage(list)
}).catch(err => {
console.log(err)
})
}
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
let contractText = {
id: Templatel.T_emplateId ? Templatel.T_emplateId : 0,
templateId: Templatel.templateId ? Templatel.templateId : Templatel.id,
isUseElectronicContract: checkNick ? 1 : 0,
contractName: Templatel.name,
contractUrl: Templatel.fileExampleUrl ? Templatel.fileExampleUrl : Templatel.contractUrl
}
resolve(contractText)
})
}
})
useEffect(() => {
contractTemplate();
}, [])
useEffect(() => {
if (ctText != null) {
ctText.name = ctText.contractName;
ctText.T_emplateId = ctText.id;
ctText.id = ctText.templateId;
setCheckNick(ctText.isUseElectronicContract ? true : false)
setTemplatel(ctText)
console.log(ctText, 1313131)
}
}, [ctText])
/**判断文件类型和大小 */
const beforeDocUpload = (file: any) => {
const isLt20M = file.size / 1024 / 1024 < 20;
if (!isLt20M) {
message.error('上传文件大小不超过 20M!');
}
return isLt20M;
}
// 上传回调
const handleChange = ({ fileList }) => {
if (fileList[0].response) {
if (fileList[0].response.code === 1000) {
Templatel.name = fileList[0].name
Templatel.fileUrl = fileList[0].response.data
console.log(Templatel, '上传成功执行的')
setTemplatel({ ...Templatel })
}
}
}
/* 生成电子合同 */
const generate = () => {
if (!Templatel.id) {
message.info('请先选择合同模版')
} else {
const param = {
contractTemplateId: Templatel.id,
memberId,
}
PublicApi.postContractSignatureContractCreate(param).then(res => {
console.log(res);
if (res.code == 1000) {
const Temp = Templatel;
Temp.contractName = res.data.contractName
Temp.name = res.data.contractName
Temp.fileUrl = res.data.contractUrl
setTemplatel(Temp)
console.log(Temp)
}
})
}
}
return (
<div
style={{
width: '100%',
}}
>
<Form.Item label="合同模板" labelAlign="left" labelCol={{ span: 2 }}>
<Select
value={Templatel.id}
style={{ width: 600 }}
options={TemplatePage}
placeholder="请选择合同模板"
onChange={(e) => getTemplate(e)}
>
</Select>
{
checkNick && <Button type='link' onClick={() => generate()}>生成合同</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>
<Upload
action="/api/file/file/upload"
data={{ fileType: UPLOAD_TYPE }}
showUploadList={false}
beforeUpload={beforeDocUpload}
onChange={handleChange}
accept='.doc,.docx'
>
<div className={styles.uploadIconBtn}>
<Button type='link' >上传合同</Button>
</div>
</Upload>
</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) => {
const { currentRef, payPlanList, Price } = props;
// const [payNumArr, setpayNumArr] = useState<any>([1,])
const [keys, setkeys] = useState<any>(); // 记录上次删除的
const [options, setoptions] = useState<any>([
{
value: 1,
disabled: true
}
])
const [PlanList, setPlanList] = useState<any>([
]);
/* 显示模态框 */
const tabcolumns: any = [
{
title: '付款次数', dataIndex: 'payNum', align: 'left',
render: (_, item, index) => {
return (
<Select
style={{ width: 200 }}
defaultValue={item.payNum}
options={options}
key='1'
onChange={(e) => onSelectChange(e, 'payNum', index)}
>
</Select>
)
}
},
{
title: '付款阶段', dataIndex: 'payStage', align: 'left',
render: (_, item, index) => <TextArea defaultValue={item.payStage} maxLength={150} rows={1} onChange={(e) => onSelectChange(e, 'payStage', index)} />
},
{
title: '预计付款时间', dataIndex: 'expectPayTime', align: 'left',
render: (_, item, index) => <DatePicker
style={{ width: '100%' }}
format="YYYY-MM-DD"
defaultValue={item.expectPayTime}
onChange={(e) => onSelectChange(e, 'expectPayTime', index)}
/>
},
{
title: '付款比例', dataIndex: 'payRatio', align: 'left',
render: (text, item, index) =>
<div className={styles.flex}>
<Input
style={{
width: 150,
}}
// defaultValue={text}
value={text}
placeholder=""
onChange={(e) => onSelectChange(e, 'payRatio', index)}
/>
<span>%</span>
</div>
},
{
title: '付款金额', dataIndex: 'payAmount', align: 'left',
render: (text, item, index) =>
<div className={styles.flex}>
<span></span>
<Input
style={{
width: 130,
}}
placeholder=""
value={text}
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={String(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 defaultValue={item.payParam} 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];
if (keys) {
data.push(keys);
setkeys('');
} else {
data.push(
{
payNum: data.length + 1,
payStage: '',
expectPayTime: '',
payRatio: '',
payAmount: '',
payWay: '1',
payParam: '',
id: 0,
rowId: data.length + 1,
disabled: false,
},
)
}
let optionsData = data.map((item, index) => {
return {
value: item.payNum ? item.payNum : index + 1,
disabled: item.payNum ? true : false,
rowId: item.rowId,
}
})
setPlanList(data)
setoptions(optionsData)
};
/* 删除 */
const Delete = (elm, idx) => {
const dataSource = [...PlanList];
let List = dataSource.filter((item, index) => index !== idx);
let optionsData = options.map((keys => {
if (elm.payNum == keys.value) {
keys.disabled = false;
}
return {
...keys
}
}))
setkeys(elm);
setPlanList(List)
setoptions(optionsData)
};
/* 选中设置值 */
const onSelectChange = (e, name, idx) => {
console.log(e, name, idx)
let item = [...PlanList];
// return;
switch (name) {
case 'payWay':
item[idx].payWay = e;
break;
case 'payNum':
item[idx].payNum = 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':
if (Price != 0) {
item[idx].payAmount = e.target.value / 100 * Price;
}
item[idx].payRatio = e.target.value;
break;
case 'payAmount':
if (Price != 0) {
item[idx].payRatio = e.target.value / Price * 100;
}
item[idx].payAmount = e.target.value;
break;
case 'payParam':
item[idx].payParam = e;
break;
}
setPlanList(item)
}
useEffect(() => {
payPlanList.map(item => {
item.expectPayTime = moment(item.expectPayTime)
})
setPlanList(payPlanList)
console.log(payPlanList)
}, [payPlanList])
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
PlanList.map(item => {
item.id = item.id
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="rowId"
style={{
width: "100%"
}}
pagination={false}
/>
<div style={{ background: '#F4F5F7' }} onClick={() => addtable()} >
<Button block type='dashed'><PlusOutlined />添加付款计划</Button>
</div>
</div>
)
}
export default forwardRef(FormList)
import React, { useState, useEffect, forwardRef } from 'react';
import { Button, Input, Select, DatePicker, Form, Drawer } from 'antd'
import { PublicApi } from '@/services/api';
import style from '../../../constants/styles.less'
import moment from 'moment';
const { Option } = Select;
const { RangePicker } = DatePicker;
const Information = (props: any) => {
const { currentRef, basic, oldContractId } = props;
const [attrValueForm] = Form.useForm();
const [startTime, setstartTime] = useState('');
const [endTime, setendTime] = useState('');
/**
* @param {{basicsVO}} 表单数据集合
* */
useEffect(() => {
basic.sourceType = String(basic.sourceType);
if (basic.contractNo) {
if (oldContractId) {
let data = { oldContractNo: basic.contractNo }
console.log(data, 123131, basic)
PublicApi.getContractManageGetContractNo(data).then(res => {
console.log(res.data)
if (res.code === 1000) {
basic.contractNo = res.data;
const rangePicker = [];
let startTime = moment(basic.startTime)
let endTime = moment(basic.endTime);
rangePicker.push(startTime, endTime);
basic.rangePicker = rangePicker;
attrValueForm.setFieldsValue(basic)
}
}).catch((err) => {
});
} else {
const rangePicker = [];
let startTime = moment(basic.startTime)
let endTime = moment(basic.endTime);
rangePicker.push(startTime, endTime);
basic.rangePicker = rangePicker;
attrValueForm.setFieldsValue(basic)
}
}
}, [basic])
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
attrValueForm.validateFields().then(res => {
resolve({
state: true,
name: 'basic',
data: Object.assign(res, {
id: oldContractId ? 0 : basic.id,
partyBRoleId: basic.partyBRoleId,
startTime, endTime,
sourceId: basic.sourceId,
totalAmount: basic.totalAmount,
partyBMemberId: basic.partyBMemberId,
partyBName: basic.partyBName,
oldContractId: oldContractId ? basic.id : 0
}),
})
}).catch(error => {
if (error && error.errorFields) {
}
})
})
}
})
/* 时间选中 */
const onChange = (value: any) => {
console.log(value)
let startTime = moment(Number(value[0])).format('YYYY-MM-DD HH:mm:ss')
let endTime = moment(Number(value[1])).format('YYYY-MM-DD HH:mm:ss')
setstartTime(startTime)
setendTime(endTime)
}
const rangeConfig = {
rules: [{ type: 'array' as const, required: true, message: ' 请选择开始或者结束时间' }],
};
return (
<div className={style.revise_info}>
<Form
form={attrValueForm}
name="edit_infomation"
layout="horizontal"
labelAlign="left"
colon={false}
autoComplete="off"
>
<Form.Item
label="合同编号"
labelAlign="left"
name="contractNo"
labelCol={{ span: 2 }}
wrapperCol={{ span: 8 }}
initialValue={basic.contractNo}
rules={[
{
required: true,
message: '请输入合同编号',
},
]}
>
{/* disabled */}
<Input placeholder='请输入合同编号' disabled />
</Form.Item>
<Form.Item
label="合同摘要"
labelAlign="left"
name="contractAbstract"
labelCol={{ span: 2 }}
wrapperCol={{ span: 8 }}
rules={[
{
required: true,
message: '请输入合同摘要',
},
]}
>
<Input placeholder='请输入合同摘要' />
</Form.Item>
<Form.Item
label="寻源类型"
labelAlign="left"
name="sourceType"
labelCol={{ span: 2 }}
wrapperCol={{ span: 8 }}
initialValue={basic.sourceType}
rules={[
{
required: true,
message: '请选择寻源类型',
},
]}
>
<Select disabled>
<Option value="1" >采购询价</Option>
<Option value="2" >采购招标</Option>
<Option value="3" >采购竞价</Option>
</Select>
</Form.Item>
<Form.Item
label="合同有效期"
labelAlign="left"
labelCol={{ span: 2 }}
wrapperCol={{ span: 8 }}
name="rangePicker"
{...rangeConfig}
>
<RangePicker style={{ width: '100%' }}
onChange={(e) => onChange(e)}
/>
</Form.Item>
<Form.Item
label="对应单据"
labelAlign="left"
labelCol={{ span: 2 }}
name="sourceNo"
initialValue={basic.sourceNo ? basic.sourceNo : ''}
wrapperCol={{ span: 8 }}
>
<Input placeholder='最长60个字符,30个汉字' disabled />
</Form.Item>
<Form.Item
label="授标会员"
labelAlign="left"
labelCol={{ span: 2 }}
name="partyBName"
initialValue={basic.partyBName ? basic.partyBName : ''}
wrapperCol={{ span: 8 }}
rules={[
{
required: true,
message: '请选择授标会员',
},
]}
>
<Input placeholder='最长60个字符,30个汉字' disabled />
</Form.Item>
<Form.Item
label="授标金额"
labelAlign="left"
labelCol={{ span: 2 }}
wrapperCol={{ span: 8 }}
>
<p>{basic.totalAmount ? `¥${basic.totalAmount}` : ''}</p>
</Form.Item>
</Form>
</div>
)
}
export default forwardRef(Information)
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