shenqing
This commit is contained in:
@ -1,13 +1,35 @@
|
||||
import React, { useState, useRef } from 'react';
|
||||
import {Radio, message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree, DatePicker } from 'antd';
|
||||
import {Table,Radio, message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree, DatePicker } from 'antd';
|
||||
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
|
||||
import { getPage, getDataById, deleteAgency, addAgency, updateAgency,disableAgency } from './service';
|
||||
// import './styles.less';
|
||||
import { getDicData } from '@/utils/session';
|
||||
import { getSessionRoleData,getDicData,getSessionUserData } from '@/utils/session';
|
||||
import TextArea from 'antd/lib/input/TextArea';
|
||||
import SelectProvider from './components/SelectProvider';
|
||||
import 'moment/locale/zh-cn';
|
||||
import locale from 'antd/es/date-picker/locale/zh_CN';
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import advancedFormat from 'dayjs/plugin/advancedFormat'
|
||||
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
||||
import localeData from 'dayjs/plugin/localeData'
|
||||
import weekday from 'dayjs/plugin/weekday'
|
||||
import weekOfYear from 'dayjs/plugin/weekOfYear'
|
||||
import weekYear from 'dayjs/plugin/weekYear'
|
||||
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(advancedFormat)
|
||||
dayjs.extend(weekday)
|
||||
dayjs.extend(localeData)
|
||||
dayjs.extend(weekOfYear)
|
||||
dayjs.extend(weekYear)
|
||||
|
||||
|
||||
dayjs.locale('zh-cn');
|
||||
const agency: React.FC<{}> = () => {
|
||||
|
||||
let userData: any=getSessionUserData();
|
||||
//获取字典
|
||||
const getDict: any = getDicData();
|
||||
const [form] = Form.useForm();
|
||||
@ -22,6 +44,7 @@ const agency: React.FC<{}> = () => {
|
||||
const [selectProviderVisible, setSelectProviderVisible] = useState<boolean>(false);
|
||||
const [currentRecord, setCurrentRecord] = useState<any>(null);
|
||||
const [showEndDate, setShowEndDate] = useState<boolean>(false);
|
||||
const [dataSource, setdataSource] = useState<any>();
|
||||
//查询分页数据
|
||||
const [pageData, pageDataSet] = useState<any>({
|
||||
pageNo: 1,
|
||||
@ -35,20 +58,37 @@ const agency: React.FC<{}> = () => {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
const sys_normal_scope: DictType[] = [
|
||||
{ value: 'EBTP', label: '招标采购中心' },
|
||||
];
|
||||
|
||||
const [date, setDate] = useState<any>(dayjs(new Date()));
|
||||
const columnsAgencyInvalidations= [
|
||||
{ title: '序号', valueType: 'index',},
|
||||
{
|
||||
title: '有效期开始',
|
||||
dataIndex: 'periodBegin',
|
||||
key: 'periodBegin',
|
||||
},
|
||||
{
|
||||
title: '有效期结束',
|
||||
dataIndex: 'periodEnd',
|
||||
key: 'periodEnd',
|
||||
},
|
||||
{
|
||||
title: '失效类型',
|
||||
dataIndex: 'invalidType',
|
||||
key: 'invalidType',
|
||||
},
|
||||
|
||||
];
|
||||
//委托列表
|
||||
const columns: ProColumns<any>[] = [
|
||||
{ title: '序号', valueType: 'index', width: 50, search: false, },
|
||||
{ title: '代理机构名称', dataIndex: 'providerName', },//, ellipsis: true
|
||||
{ title: '申请人', dataIndex: 'applyUser', search: false, },//, ellipsis: true//, ellipsis: true
|
||||
{ title: '开始服务时间', dataIndex: 'periodBegin', search: false, },//, ellipsis: true
|
||||
{ title: '开始服务时间', dataIndex: 'createDate', search: false, },//, ellipsis: true
|
||||
{ title: '准入人', dataIndex: 'accessUser', search: false, },//, ellipsis: true
|
||||
{ title: '失效时间', dataIndex: 'periodEnd', search: false,},//, ellipsis: true
|
||||
{ title: '状态', dataIndex: 'validityStatus', valueType: 'select',
|
||||
valueEnum: { '1': { text: '有效', status: '1' },'2': { text: '失效', status: '2' }, },
|
||||
valueEnum: {'0': { text: '审批中', status: '0' }, '1': { text: '有效', status: '1' },'2': { text: '失效', status: '2' }, },
|
||||
},//, ellipsis: true
|
||||
{ title: 'id', dataIndex: 'id', search: false,hideInTable:true,},//, ellipsis: true
|
||||
// { title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false },
|
||||
@ -140,13 +180,21 @@ const agency: React.FC<{}> = () => {
|
||||
form.resetFields();
|
||||
const agencyDetail = await getDataById(record.id);
|
||||
|
||||
if(agencyDetail&&(agencyDetail?.code == 200)&&agencyDetail.data&&agencyDetail.data.providerDetail) {
|
||||
if(agencyDetail&&(agencyDetail?.code == 200)&&agencyDetail.data) {
|
||||
setCurrentRecord(agencyDetail.data.providerDetail);
|
||||
setShowEndDate(agencyDetail.data.validity === '2');
|
||||
setdataSource(agencyDetail.data.agencyInvalidations);
|
||||
|
||||
form.setFieldsValue({
|
||||
...agencyDetail.data
|
||||
});
|
||||
if(agencyDetail.data.providerDetail && agencyDetail.data.periodEnd){
|
||||
console.log(agencyDetail.data.periodEnd);
|
||||
setDate(dayjs(agencyDetail.data.periodEnd, 'YYYY-MM-DD'));
|
||||
|
||||
}
|
||||
}
|
||||
form.setFieldsValue({
|
||||
...agencyDetail.data
|
||||
});
|
||||
|
||||
|
||||
setOpen(true);
|
||||
setTitle('修改代理机构');
|
||||
@ -164,8 +212,8 @@ const agency: React.FC<{}> = () => {
|
||||
const values = await form.validateFields();
|
||||
|
||||
// 处理日期,确保只保留日期部分
|
||||
if (values.periodEnd) {
|
||||
values.periodEnd = values.periodEnd.format('YYYY-MM-DD');
|
||||
if (date && values.validity==='2') {
|
||||
values.periodEnd =date.format('YYYY-MM-DD');
|
||||
}
|
||||
|
||||
if (values.id) {
|
||||
@ -241,26 +289,40 @@ const agency: React.FC<{}> = () => {
|
||||
}}>
|
||||
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
|
||||
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}>姓名:</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.applyUser || '-'}</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{userData?.fullName || '-'}</span>
|
||||
</div>
|
||||
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
|
||||
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}>工号:</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.name || '-'}</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{userData?.fullName || '-'}</span>
|
||||
</div>
|
||||
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
|
||||
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}>角色:</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.kindCode || '-'}</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{userData?.fullName || '-'}</span>
|
||||
</div>
|
||||
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
|
||||
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}>公司:</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.kindName || '-'}</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{userData?.fullName || '-'}</span>
|
||||
</div>
|
||||
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
|
||||
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}>部门:</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.goodsTypeCode || '-'}</span>
|
||||
<span className="info-content" style={{ flex: '1' }}>{userData?.fullName || '-'}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div className="info-display" style={{
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
margin: '0 -1%',
|
||||
marginBottom: '1.5rem'
|
||||
}}>
|
||||
{
|
||||
dataSource && ( <Table dataSource={dataSource} columns={columnsAgencyInvalidations} title={()=>"历史记录"} />)
|
||||
}
|
||||
|
||||
|
||||
</div>
|
||||
<Form form={form} {...layout}>
|
||||
|
||||
<Form.Item label="供应商ID" name="providerId" hidden>
|
||||
@ -291,13 +353,14 @@ const agency: React.FC<{}> = () => {
|
||||
</Form.Item>
|
||||
|
||||
{showEndDate && (
|
||||
<Form.Item label="结束日期" name="periodEnd">
|
||||
<DatePicker style={{ width: '100%' }} format="YYYY-MM-DD" picker="date" />
|
||||
<Form.Item label="结束日期" >
|
||||
<DatePicker value={date} onChange={(date) => setDate(date)} disabledDate={(current) => current && current < moment().startOf('day')} style={{ width: '100%' }} format={'YYYY-MM-DD'} />
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
|
||||
</Form>
|
||||
|
||||
|
||||
</Modal>
|
||||
);
|
||||
|
Reference in New Issue
Block a user