diff --git a/src/pages/ElecEvalReserve/index.tsx b/src/pages/ElecEvalReserve/index.tsx index 8f9831a..c63a66e 100644 --- a/src/pages/ElecEvalReserve/index.tsx +++ b/src/pages/ElecEvalReserve/index.tsx @@ -1,251 +1,272 @@ -import React, { useState, useRef } from 'react'; -import { Button, Tabs, Form, Input, Modal, Space, Checkbox, message, PageHeader, Popconfirm, Progress, Tag, Spin } from 'antd'; +import React, { useState, useRef, useEffect } from 'react'; +import { Button, Tabs, PageHeader } from 'antd'; import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table'; -import { reserveList } from './service'; +import { reserveList, roomList } from './service'; import '@/assets/ld_style.less'; -import { getProjectTypeCode, getURLInformation, getUrlParam, isNotEmpty } from '@/utils/CommonUtils'; +import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils'; import { btnAuthority } from '@/utils/authority'; const { TabPane } = Tabs; - const Index: React.FC<{}> = () => { const checkRelationRef = useRef(); //操作数据后刷新列表 + const [areaNameList, setAreaNameList] = useState({}); + /*拉取数据*/ + useEffect(() => { + initAreaNameList(); + }, []); + const initAreaNameList = async () => { + await roomList().then((res) => { + if (res.success ==true) { + // let areaNameList: any[] = []; + // console.log(res.data) + // res.data.forEach((item: { areaName: string; id: string; }) => { + // const tempDetail = { label: '', value: '', }; + // tempDetail.label = item.areaName; + // tempDetail.value = item.id; + // areaNameList.push(tempDetail); + // }) + let areaNameList = {}; + //将拿到的返回值遍历 + res.data.map((item: { id: string | number; areaName: any; })=>{ + //使用接口返回值的id做为 代替原本的0,1 + areaNameList[item.id]={ + //使用接口返回值中的overdueValue属性作为原本的text:后面的值 + text: item.areaName, + } + }) + setAreaNameList(areaNameList) + } + }) +}; + const current = getURLInformation('current'); - - //存储当前页面项目类型 - let proTypeCode = getProjectTypeCode(); - - const current = getURLInformation("current"); - - - const columns: any = [ // 我参与的项目 + const columns: any = [ + // 我参与的项目 { title: '序号', dataIndex: 'index', valueType: 'index', search: false, - width: '2%', + width: '3%', }, { title: '评标室', - dataIndex: 'areaName', + dataIndex: 'areaId', + valueType: 'select', + valueEnum: areaNameList, search: true, - width: '15%', + width: '10%', }, { title: '预约开始时间', dataIndex: 'reserveStartDate', search: true, valueType: 'dateTime', - width: '15%', + width: '10%', }, { title: '预约结束时间', dataIndex: 'reserveEndDate', search: true, valueType: 'dateTime', - width: '15%', + width: '10%', }, { title: '预约人', dataIndex: 'reserveBy', width: '5%', - search: false + search: false, }, { - title: '预约人联系方式', + title: '预约人联系方式', dataIndex: 'reserveContactNumber', width: '5%', - search: false + search: false, }, { title: '项目名称', dataIndex: 'projectName', search: false, - width: '10%' + width: '10%', }, { title: '标段名称', dataIndex: 'sectionNames', search: false, - width: '10%' - }, + width: '10%', + }, { title: '操作', width: '7%', search: false, render: (text: any, record: any) => { - return ( <> - - + - ) - - } + ); + }, }, ]; - const otherColumns: any[] = [ //会议室预约 - - { - title: '序号', - dataIndex: 'index', - valueType: 'index', - search: false, - width: 50, - }, - { - title: '会议室名称', - dataIndex: 'areaName', - }, - { - title: '预约开始时间', - dataIndex: 'reserveStartDate', - search: false, - width: '5%', - }, - { - title: '预约结束时间', - dataIndex: 'reserveEndDate', - search: false, - width: '7%', - }, - { - title: '预约人', - dataIndex: 'reserveBy', - width: '20%', - search: false - }, - { - title: '预约人联系方式', - dataIndex: 'reserveContactNumber', - width: '10%', - search: false - }, - { - title: '操作', - width: '7%', - search: false, - render: (text: any, record: any) => { + const otherColumns: any[] = [ + //会议室预约 - return ( - <> - - - - ) - - } - }, + { + title: '序号', + dataIndex: 'index', + valueType: 'index', + search: false, + width: '3%', + }, + { + title: '会议室名称', + dataIndex: 'areaName', + search: true, + width: '10%', + }, + { + title: '预约开始时间', + dataIndex: 'reserveStartDate', + search: true, + width: '10%', + }, + { + title: '预约结束时间', + dataIndex: 'reserveEndDate', + search: true, + width: '10%', + }, + { + title: '预约人', + dataIndex: 'reserveBy', + width: '5%', + search: false, + }, + { + title: '预约人联系方式', + dataIndex: 'reserveContactNumber', + width: '5%', + search: false, + }, + { + title: '操作', + width: '7%', + search: false, + render: (text: any, record: any) => { + return ( + <> + + + ); + }, + }, ]; - - return ( <> - + - - - - - - await reserveList(params).then((res) => { - if (res.code == 200) { - let data = res.data; - return Promise.resolve({ - data: data.records, - success: res.success, - total: res.data.total, - current: res.data.current, - }); - } + + + + await reserveList(params).then((res) => { + if (res.code == 200) { + let data = res.data; return Promise.resolve({ - data: [], - success: false, - total: 0, - current: 1, + data: data.records, + success: res.success, + total: res.data.total, + current: res.data.current, }); - }) - } - search={{ - filterType: "query", - optionRender: (searchConfig: any, { form }) => { - return [ - , - , - ]; - }, - }} - pagination={{ defaultCurrent: isNotEmpty(current) ? Number(current) : 1, defaultPageSize: 10, showSizeChanger: false }}//默认显示条数 - toolBarRender={false} - /> - - - - - - await reserveList(params).then((res) => { - if (res.code == 200) { - let data = res.data; - return Promise.resolve({ - data: data.records, - success: res.success, - total: res.data.total, - current: res.data.current, - }); - } + } + return Promise.resolve({ + data: [], + success: false, + total: 0, + current: 1, + }); + }) + } + search={{ + filterType: 'query', + optionRender: (searchConfig: any, { form }) => { + return [ + , + , + ]; + }, + }} + pagination={{ + defaultCurrent: isNotEmpty(current) ? Number(current) : 1, + defaultPageSize: 10, + showSizeChanger: false, + }} //默认显示条数 + toolBarRender={false} + /> + + + + await reserveList(params).then((res) => { + if (res.code == 200) { + let data = res.data; return Promise.resolve({ - data: [], - success: false, - total: 0, - current: 1, + data: data.records, + success: res.success, + total: res.data.total, + current: res.data.current, }); - }) - } - pagination={{ defaultPageSize: 10, showSizeChanger: false }}//默认显示条数 - toolBarRender={false} - /> - - + } + return Promise.resolve({ + data: [], + success: false, + total: 0, + current: 1, + }); + }) + } + pagination={{ defaultPageSize: 10, showSizeChanger: false }} //默认显示条数 + toolBarRender={false} + /> + + - ) -} + ); +}; export default Index diff --git a/src/pages/ElecEvalReserve/service.ts b/src/pages/ElecEvalReserve/service.ts index 8537586..c056ebc 100644 --- a/src/pages/ElecEvalReserve/service.ts +++ b/src/pages/ElecEvalReserve/service.ts @@ -7,10 +7,18 @@ export async function reserveList(data: any) { // 查询会议室/评标室预 }); } -export async function roomList(data: any) { // 查询评标室列表 +export async function roomList() { // 查询评标室列表 ///api/biz-service-ebtp-evaluation - return request('http://localhost:18017/v1/elec/eval/room/list', { + return request('/v1/elec/eval/room/list', { + method: 'get', + params: {} + }); +} + + +export async function cancelReserve(id: any) { // 取消预约 + ///api/biz-service-ebtp-evaluation + return request('/v1/eval/room/reserve/cancel'+`${id}`, { method: 'get', - params: data }); }