评标场所、区域、设备开发完成

This commit is contained in:
袁帅
2022-09-28 14:49:19 +08:00
parent 48e74053e3
commit 629f1bb304
7 changed files with 631 additions and 323 deletions

View File

@ -3,7 +3,7 @@ import { Button, Form, Input, message, Modal, Select, Spin, Row, Col } from "ant
import Password from "antd/lib/input/Password"; import Password from "antd/lib/input/Password";
import { fromPairs, values } from "lodash"; import { fromPairs, values } from "lodash";
import React, { useEffect, useRef, useState } from "react" import React, { useEffect, useRef, useState } from "react"
import SelectDeviceModal from "./SelectDeviceModal"; import SelectExternDeviceModal from "./SelectExternDeviceModal";
import { getDeviceById, saveDevice } from "./service"; import { getDeviceById, saveDevice } from "./service";
@ -197,11 +197,14 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
// @ts-ignore // @ts-ignore
return ( return (
<div> <>
<Modal <Modal
mask={true} mask={true}
destroyOnClose destroyOnClose
title={titleName} maskClosable={false}
title={<div>
<span></span>
</div>}
visible={modalVisible} visible={modalVisible}
onCancel={() => onCancel()} onCancel={() => onCancel()}
onOk={() => form.submit()} onOk={() => form.submit()}
@ -247,7 +250,7 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
> >
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item label="设备名称"> <Form.Item label="设备名称" required>
<Form.Item name="deviceName" noStyle rules={[{ required: true, message:'请填写设备名称/选择设备' }]}> <Form.Item name="deviceName" noStyle rules={[{ required: true, message:'请填写设备名称/选择设备' }]}>
<Input style={{ width: 'calc(85% - 8px)' }} placeholder="请填写设备名称/选择设备" maxLength={200} /> <Input style={{ width: 'calc(85% - 8px)' }} placeholder="请填写设备名称/选择设备" maxLength={200} />
</Form.Item> </Form.Item>
@ -311,8 +314,8 @@ const DeviceForm: React.FC<DeviceFormProps> = (props) => {
</Form> </Form>
</Spin> </Spin>
</Modal> </Modal>
<SelectDeviceModal modalVisible={selectDeviceStatus} onCancel={() => setSelectDeviceStatus(false)} onSubmit = {(value: any) => SelectDeviceData(value)} values ={deviceRelData?.current}> </SelectDeviceModal> <SelectExternDeviceModal modalVisible={selectDeviceStatus} onCancel={() => setSelectDeviceStatus(false)} onSubmit = {(value: any) => SelectDeviceData(value)} values ={deviceRelData?.current}> </SelectExternDeviceModal>
</div> </>
) )
} }
export default DeviceForm export default DeviceForm

View File

@ -261,12 +261,9 @@ const DeviceManage: React.FC<{}> = () => {
filterType: 'query', filterType: 'query',
optionRender: (searchConfig: any, { form }) => { optionRender: (searchConfig: any, { form }) => {
return [ return [
<Button key="toCreate"
type="primary" onClick={() => toAdd()}>
</Button>,
<Button <Button
key="searchText" key="searchText"
type="primary"
onClick={() => { onClick={() => {
form?.submit(); form?.submit();
}} }}
@ -285,6 +282,10 @@ const DeviceManage: React.FC<{}> = () => {
> >
{searchConfig?.resetText} {searchConfig?.resetText}
</Button>, </Button>,
<Button key="toCreate"
type="primary" onClick={() => toAdd()}>
</Button>,
]; ];
}, },
}} }}

View File

@ -1,7 +1,8 @@
import { ConsoleSqlOutlined } from '@ant-design/icons'; import { ConsoleSqlOutlined } from '@ant-design/icons';
import { Spin, Modal, message, Button, Form, Input, Select, InputNumber } from 'antd'; import { Spin, Modal, message, Button, Form, Input, Select, InputNumber } from 'antd';
import React, { useState, useEffect, useImperativeHandle, forwardRef } from 'react'; import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef } from 'react';
import { saveAreasInfo, getPlaceListByPermission, getPlatAreaList } from '../../service'; import { saveAreasInfo, getPlaceListByPermission, getPlatAreaList } from '../../service';
import SelectExternAreaModal from './SelectExternAreaModal';
interface AreasModalProps { interface AreasModalProps {
areasInfo: AreasInfo; areasInfo: AreasInfo;
@ -49,6 +50,8 @@ interface AreaOptions {
const [saveLoading, setSaveLoading] = useState<boolean>(false); const [saveLoading, setSaveLoading] = useState<boolean>(false);
const [placeList, setPlaceList] = useState<any[]>([]); const [placeList, setPlaceList] = useState<any[]>([]);
const [areaList, setAreaList] = useState<any[]>([]); const [areaList, setAreaList] = useState<any[]>([]);
const [selectAreaStatus, setSelectAreaStatus] = useState<any>();
const currentPlace = useRef<any>();
const [form] = Form.useForm(); const [form] = Form.useForm();
const clearForm = () => { const clearForm = () => {
form.resetFields(); form.resetFields();
@ -109,19 +112,20 @@ interface AreaOptions {
placeId: value['value'], placeId: value['value'],
}) })
getPlatAreaList({placeId: value['key']}).then(res => { currentPlace.current = value['value'];
if(res.code === 200){ // getPlatAreaList({placeId: value['key']}).then(res => {
setAreaList(EnvAreaOptions(res.data)); // if(res.code === 200){
} // setAreaList(EnvAreaOptions(res.data));
}) // }
// })
} }
const handleAreaRegionChange = (value:any) => { // const handleAreaRegionChange = (value:any) => {
form.setFieldsValue({ // form.setFieldsValue({
areaRegionCode: value['value'], // areaRegionCode: value['value'],
areaRegionName: value['label'] // areaRegionName: value['label']
}) // })
} // }
// const renderFooter = () => { // const renderFooter = () => {
// return ( // return (
@ -150,113 +154,130 @@ interface AreaOptions {
}); });
} }
return (<Modal const ShowExternAreaModal = () => {
destroyOnClose = {true} if(form.getFieldValue(['placeId'])){
visible = {modalVisible} setSelectAreaStatus(true);
cancelText="关闭" }else{
okText="保存" message.error('请先选择评标场所');
okButtonProps={{loading: saveLoading}} }
onCancel = {() => {onCancel();clearForm();}} }
onOk = {() => {form.submit();}}
title={<div> const selectExternAreaCallBack = (value: any) => {
<span></span> form.setFieldsValue({
</div>} areaRegionName: value['name'],
// footer={renderFooter()} areaName: value['name'],
width={"30%"} areaRegionCode: value['indexCode']
})
}
return (<><Modal
destroyOnClose={true}
maskClosable={false}
visible={modalVisible}
cancelText="关闭"
okText="保存"
okButtonProps={{ loading: saveLoading }}
onCancel={() => { onCancel(); clearForm(); } }
onOk={() => { form.submit(); } }
title={<div>
<span></span>
</div>}
// footer={renderFooter()}
width={"30%"}
>
<Spin spinning={saveLoading}>
<Form
name="basic"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
initialValues={{ remember: true }}
onFinish={onFinish}
form={form}
// onFinishFailed={onFinishFailed}
autoComplete="off"
> >
<Spin spinning={saveLoading}> <Form.Item hidden={true} name="id" initialValue={areasInfo?.id}>
<Form <Input />
name="basic" </Form.Item>
labelCol={{ span: 8 }} <Form.Item hidden={true} name="status" initialValue={areasInfo?.status}>
wrapperCol={{ span: 16 }} <Input />
initialValues={{ remember: true }} </Form.Item>
onFinish={onFinish} <Form.Item hidden={true} name="areaRegionName" initialValue={areasInfo?.areaRegionName}>
form={form} <Input />
// onFinishFailed={onFinishFailed} </Form.Item>
autoComplete="off" <Form.Item
> label="评标场所"
<Form.Item hidden={true} name="id" initialValue={areasInfo?.id}> name="placeId"
<Input /> rules={[{ required: true, message: '请选择评标场所' }]}
</Form.Item> initialValue={areasInfo?.placeId}>
<Form.Item hidden={true} name="status" initialValue={areasInfo?.status}> <Select labelInValue options={placeList} placeholder='请选择' onChange={handlePlaceChange}>
<Input /> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item label="评标区域名称" required initialValue={areasInfo?.areaName}>
label="评标场所" <Form.Item name="areaName" noStyle rules={[{ required: true, message: '请填写评标区域名称/选择评标区域' }]}>
name="placeId" <Input style={{ width: 'calc(85% - 8px)' }} placeholder="请填写评标区域名称/选择评标区域" maxLength={200} />
rules={[{ required: true, message: '请选择评标场所' }]} </Form.Item>
initialValue = {areasInfo?.placeId}> <Button style={{ width: 'calc(15%)', margin: '0 0 0 8px' }} type='primary' onClick={() => ShowExternAreaModal()}></Button>
<Select labelInValue options={placeList} placeholder='请选择' onChange={handlePlaceChange}> </Form.Item>
</Select> {/* <Form.Item
</Form.Item> label="评标区域"
<Form.Item name="areaRegionName"
label="评标区域" rules={[{ required: true, message: '请选择评标区域' }]}
name="areaRegionName" initialValue={areasInfo?.areaRegionName}
rules={[{ required: true, message: '请选择评标区域' }]} >
initialValue={areasInfo?.areaRegionName} <Select labelInValue options={areaList} placeholder='请选择' onChange={handleAreaRegionChange}>
> </Select>
<Select labelInValue options={areaList} placeholder='请选择' onChange={handleAreaRegionChange}> </Form.Item> */}
</Select> <Form.Item label="评标区域编码" name="areaRegionCode" rules={[{ required: true, message: '请选择评标区域/填写评标区域编码' }]} initialValue={areasInfo?.areaRegionCode}>
</Form.Item> <Input placeholder='请选择评标区域/填写评标区域编码' maxLength={100} />
<Form.Item label="评标区域编码" name="areaRegionCode" initialValue={areasInfo?.areaRegionCode}> </Form.Item>
<Input disabled placeholder='选择评标区域自动回显'/> <Form.Item
</Form.Item> label="区域类型"
<Form.Item name="areaType"
label="区域类型" rules={[{ required: true, message: '请选择区域类型' }]}
name="areaType" initialValue={areasInfo?.areaType}>
rules={[{ required: true, message: '请选择区域类型' }]} <Select placeholder='请选择'>
initialValue = {areasInfo?.areaType}> <Select.Option value="eval_room"></Select.Option>
<Select placeholder='请选择'> <Select.Option value="report_area"></Select.Option>
<Select.Option value="eval_room"></Select.Option> <Select.Option value="monitor_room"></Select.Option>
<Select.Option value="report_area"></Select.Option> </Select>
<Select.Option value="monitor_room"></Select.Option> </Form.Item>
</Select> <Form.Item
</Form.Item> label="评标区域名称"
<Form.Item name="areaName"
label="评标区域名称" rules={[
name="areaName" {
rules={[ required: true,
{ message: '请填写评标区域名称'
required: true, }
message: '请填写评标区域名称' ]}
}, initialValue={areasInfo?.areaName}
{ >
max: 50, <Input placeholder='请填写评标区域名称' maxLength={50} />
message: '最大不能超过50字' </Form.Item>
}]} <Form.Item
initialValue={areasInfo?.areaName} label="可容纳人数"
> name="areaNumber"
<Input placeholder='请填写评标区域名称'/> rules={[
</Form.Item> {
<Form.Item required: true,
label="可容纳人数" message: '请填写可容纳人数'
name="areaNumber" },
rules={[ ]}
{ initialValue={areasInfo?.areaNumber}
required: true, >
message: '请填写可容纳人数' <InputNumber min={1} max={999999} placeholder='请填写可容纳人数' style={{ width: '100%' }} />
},] </Form.Item>
} <Form.Item
initialValue={areasInfo?.areaNumber} label="详细地址"
> name="areaAddress"
<InputNumber min= {1} max={999999} placeholder='请填写可容纳人数' style={{width:'100%'}}/> initialValue={areasInfo?.areaAddress}
</Form.Item> >
<Form.Item <Input placeholder='请填写详细地址' maxLength={100} />
label="详细地址" </Form.Item>
name="areaAddress" </Form>
rules={[ </Spin>
{ </Modal><SelectExternAreaModal modalVisible={selectAreaStatus} onCancel={() => setSelectAreaStatus(false)} onSubmit={(value: any) => selectExternAreaCallBack(value)} values={currentPlace?.current}> </SelectExternAreaModal></>)
max: 100,
message: '最大不能超过100字'
}]
}
initialValue={areasInfo?.areaAddress}
>
<Input placeholder='请填写详细地址'/>
</Form.Item>
</Form>
</Spin>
</Modal>)
}) })
export default AreasModal; export default AreasModal;

View File

@ -3,6 +3,7 @@ import { isEmpty } from 'lodash';
import React, { useState, useImperativeHandle, forwardRef, useEffect, useRef } from 'react'; import React, { useState, useImperativeHandle, forwardRef, useEffect, useRef } from 'react';
import { savePlaceInfo, getServiceProvices, getPlatforms, getExternPlaces } from '../../service'; import { savePlaceInfo, getServiceProvices, getPlatforms, getExternPlaces } from '../../service';
import { getProviceList, getCityList, getAreaList, getDictRegion } from '../PcaService' import { getProviceList, getCityList, getAreaList, getDictRegion } from '../PcaService'
import SelectExternPlaceModal from './SelectExternPlaceModal';
interface PcaKeyValues{ interface PcaKeyValues{
pid?:string, pid?:string,
@ -89,6 +90,9 @@ interface PlaceInfo {
const currentCity = useRef<any>(); const currentCity = useRef<any>();
//县默认值 //县默认值
const currentCounty = useRef<any>(); const currentCounty = useRef<any>();
//当前平台
const currentPlatform = useRef<any>();
const [selectPlaceStatus,setSelectPlaceStatus] = useState<any>();
const [form] = Form.useForm(); const [form] = Form.useForm();
const platformParams = useRef<PlatFormParams>(); const platformParams = useRef<PlatFormParams>();
const clearForm = () => { const clearForm = () => {
@ -99,17 +103,18 @@ interface PlaceInfo {
currentCity.current = null; currentCity.current = null;
setAreaList([]); setAreaList([]);
currentCounty.current = null; currentCounty.current = null;
currentPlatform.current = null;
} }
useEffect(() => { useEffect(() => {
clearForm(); clearForm();
getPlatforms(platformParams).then(res =>{ getPlatforms(platformParams).then(res =>{
if(res.code === 200){ if(res.code === 200){
setPlatforms(EnvPlatformOptions(res.data)); setPlatforms(EnvPlatformOptions(res.data));
if(placeInfo?.platformList && placeInfo?.platformList[0]?.platformId){ // if(placeInfo?.platformList && placeInfo?.platformList[0]?.platformId){
getExternPlaces(placeInfo?.platformList[0]?.platformId).then(res => { // getExternPlaces(placeInfo?.platformList[0]?.platformId).then(res => {
setExternPlaces(EnvExternPlacesOptions(res.data)); // setExternPlaces(EnvExternPlacesOptions(res.data));
}) // })
} // }
} }
}) })
getServiceProvices().then(res =>{ getServiceProvices().then(res =>{
@ -143,26 +148,27 @@ interface PlaceInfo {
} }
] ]
}); });
form.resetFields(["placeRegionCode"]); currentPlatform.current = form.getFieldValue(['platformList']);
let _plaform = form.getFieldValue('platformList'); // form.resetFields(["placeRegionCode"]);
if(_plaform && _plaform[0].platformId){ // let _plaform = form.getFieldValue('platformList');
getExternPlaces({platformId: _plaform[0].platformId}).then(res => { // if(_plaform && _plaform[0].platformId){
if(res.code === 200){ // getExternPlaces({platformId: _plaform[0].platformId}).then(res => {
setExternPlaces(EnvExternPlacesOptions(res.data)); // if(res.code === 200){
} // setExternPlaces(EnvExternPlacesOptions(res.data));
}) // }
} // })
} // }
/**
* 平台场所回调
* @param value
*/
const handleExternPlaceChange = (value: any) =>{
form.setFieldsValue({
placeRegionName:value['label'],
placeRegionCode:value['value']
})
} }
// /**
// * 平台场所回调
// * @param value
// */
// const handleExternPlaceChange = (value: any) =>{
// form.setFieldsValue({
// placeRegionName:value['label'],
// placeRegionCode:value['value']
// })
// }
/** /**
* 省回调 * 省回调
*/ */
@ -373,190 +379,197 @@ interface PlaceInfo {
.finally(()=>{ .finally(()=>{
setSaveLoading(false); setSaveLoading(false);
}); });
}
const ShowExternPlaceModal = () => {
if(form.getFieldValue(['platformList'])){
setSelectPlaceStatus(true);
}else{
message.error('请先选择管理平台');
}
} }
return (<Modal const selectPlaceCallBack = (value: any) => {
destroyOnClose = {true} form.setFieldsValue({
visible = {modalVisible} placeRegionName: value['name'],
okText = "保存" placeName: value['name'],
cancelText = "关闭" placeRegionCode: value['indexCode']
okButtonProps={{loading:saveLoading}}
onCancel = {() => {onCancel();clearForm();}} })
onOk = {() => {form.submit();}} }
title={<div> return (<><Modal
<span></span> destroyOnClose={true}
</div>} maskClosable={false}
// footer={renderFooter()} visible={modalVisible}
width={"35%"} okText="保存"
cancelText="关闭"
okButtonProps={{ loading: saveLoading }}
onCancel={() => { onCancel(); clearForm(); } }
onOk={() => { form.submit(); } }
title={<div>
<span></span>
</div>}
// footer={renderFooter()}
width={"35%"}
>
<Spin spinning={saveLoading}>
<Form
name="basic"
labelCol={{ span: 4 }}
wrapperCol={{ span: 20 }}
initialValues={{ remember: true }}
form={form}
onFinish={onFinish}
> >
<Spin spinning={saveLoading}> <Form.Item hidden={true} name="id" initialValue={placeInfo?.id}>
<Form <Input />
name="basic" </Form.Item>
labelCol={{ span: 4 }} <Form.Item hidden={true} name="status" initialValue={placeInfo?.status}>
wrapperCol={{ span: 20 }} <Input />
initialValues={{ remember: true }} </Form.Item>
form={form} <Form.Item hidden={true} name="provinceDictName" initialValue={placeInfo?.provinceDictName}>
onFinish={onFinish} <Input />
// onFinishFailed={onFinishFailed} </Form.Item>
autoComplete="off" <Form.Item hidden={true} name="regionDictId" initialValue={placeInfo?.regionDictId}>
> <Input />
<Form.Item hidden={true} name="id" initialValue={placeInfo?.id}> </Form.Item>
<Input /> <Form.Item hidden={true} name="regionDictName" initialValue={placeInfo?.regionDictName}>
</Form.Item> <Input />
<Form.Item hidden={true} name="status" initialValue={placeInfo?.status}> </Form.Item>
<Input /> <Form.Item hidden={true} name="platformList" initialValue={placeInfo?.platformList}>
</Form.Item> <Input />
<Form.Item hidden={true} name="provinceDictName" initialValue={placeInfo?.provinceDictName}> </Form.Item>
<Input /> <Form.Item hidden={true} name="placeRegionName" initialValue={placeInfo?.placeRegionName}>
</Form.Item> <Input />
<Form.Item hidden={true} name="regionDictId" initialValue={placeInfo?.regionDictId}> </Form.Item>
<Input /> <Form.Item
</Form.Item> label="管理平台"
<Form.Item hidden={true} name="regionDictName" initialValue={placeInfo?.regionDictName}> name="platformId"
<Input /> rules={[{ required: true, message: '请选择管理平台' }]}
</Form.Item> initialValue={placeInfo?.platformList ? placeInfo?.platformList[0]?.platformId : null}
<Form.Item hidden={true} name="platformList" initialValue={placeInfo?.platformList}> >
<Input /> <Select labelInValue options={platforms} placeholder="请选择管理平台" onChange={handlePlatformChange}>
</Form.Item> </Select>
</Form.Item>
<Form.Item label="评标场所名称" required initialValue={placeInfo?.placeName}>
<Form.Item name="placeName" noStyle rules={[{ required: true, message: '请填写评标场所名称/选择评标场所' }]}>
<Input style={{ width: 'calc(85% - 8px)' }} placeholder="请填写评标场所名称/选择评标场所" maxLength={200} />
</Form.Item>
<Button style={{ width: 'calc(15%)', margin: '0 0 0 8px' }} type='primary' onClick={() => ShowExternPlaceModal()}></Button>
</Form.Item>
{/* <Form.Item
label="评标场所"
name="placeRegionName"
rules={[{ required: true, message: '请选择评标场所' }]}
initialValue={placeInfo?.placeRegionName}
>
<Select labelInValue options={externPlaces} placeholder="请选择评标场所" onChange={handleExternPlaceChange}>
</Select>
</Form.Item> */}
<Form.Item label="评标场所编码" name="placeRegionCode" rules={[{ required: true, message: '请选择评标场所/填写评标场所编码' }]} initialValue={placeInfo?.placeRegionCode}>
<Input placeholder='请选择评标场所/填写评标场所编码' maxLength={64} />
</Form.Item>
{/* <Form.Item
label="评标场所名称"
name="placeName"
rules={[
{
required: true,
message: '请填写评标场所名称',
}
]}
initialValue={placeInfo?.placeName}
>
<Input placeholder="请填写评标场所名称" maxLength={50} />
</Form.Item> */}
<Form.Item
label="服务省分"
name="provinceDictId"
initialValue={placeInfo?.provinceDictName}
rules={[{ required: true, message: '请选择服务省分' }]}>
<Select labelInValue options={serviceProvices} placeholder="请选择" onChange={handleServiceProvinceChange}>
</Select>
</Form.Item>
<Row>
<Col span={8}>
<Form.Item <Form.Item
label="管理平台" label="所在省"
name="platformId" labelCol={{ span: 12 }}
rules={[{ required: true, message: '请选择管理平台' }]} name="provinceId"
initialValue={placeInfo?.platformList ? placeInfo?.platformList[0]?.platformId : null} initialValue={placeInfo?.provinceName}
> rules={[{ required: true, message: '请选择所在省' }]}>
<Select labelInValue options={platforms} placeholder="请选择管理平台" onChange={handlePlatformChange}> <Select labelInValue options={provinceList} value={currentProvince?.current} placeholder="请选择" onChange={handleProvinceChange}>
</Select> </Select>
</Form.Item> </Form.Item>
</Col>
<Col span={8}>
<Form.Item <Form.Item
label="评标场所" label="所在市"
name="placeRegionName" labelCol={{ span: 12 }}
rules={[{ required: true, message: '请选择评标场所' }]} name="cityId"
initialValue={placeInfo?.placeRegionName} initialValue={placeInfo?.cityName !== '全部' ? placeInfo?.cityName : null}
> >
<Select labelInValue options={externPlaces} placeholder="请选择评标场所" onChange={handleExternPlaceChange}> <Select labelInValue options={cityList} placeholder={currentProvince?.current ? '全部' : '请选择'} onChange={handleCityChange}>
</Select> </Select>
</Form.Item> </Form.Item>
</Col>
<Form.Item label="评标场所编码" name="placeRegionCode" initialValue={placeInfo?.placeRegionCode}> <Col span={8}>
<Input disabled placeholder='选择评标场所自动回显'/>
</Form.Item>
<Form.Item <Form.Item
label="评标场所名称" label="所在县/区"
name="placeName" labelCol={{ span: 12 }}
rules={[ name="countyId"
{ initialValue={placeInfo?.countyName !== '全部' ? placeInfo?.countyName : null}
required: true,
message: '请填写评标场所名称',
},
{
max: 50,
message: '最大不能超过50字'
}
]}
initialValue={placeInfo?.placeName}
> >
<Input placeholder="请填写评标场所名称"/> <Select labelInValue options={areaList} placeholder={(currentProvince?.current !== null || currentCity?.current !== null) ? '全部' : '请选择'} onChange={handleCountyChange}>
</Form.Item>
<Form.Item
label="服务省分"
name="provinceDictId"
initialValue={placeInfo?.provinceDictName}
rules={[{ required: true, message: '请选择服务省分' }]}>
<Select labelInValue options={serviceProvices} placeholder="请选择" onChange={handleServiceProvinceChange}>
</Select> </Select>
</Form.Item> </Form.Item>
<Row> </Col>
<Col span={8}> </Row>
<Form.Item
label="所在省" <Form.Item
labelCol={{span:12}} label="详细地址"
name="provinceId" name="placeAddress"
initialValue={placeInfo?.provinceName} rules={[{
rules={[{ required: true, message: '请选择所在省' }]}> required: true,
<Select labelInValue options={provinceList} value = { currentProvince?.current } placeholder="请选择" onChange={handleProvinceChange}> message: '请填写详细地址',
</Select> }
</Form.Item> ]}
</Col> initialValue={placeInfo?.placeAddress}
<Col span={8}> >
<Form.Item <Input placeholder="请填写详细地址" maxLength={100} />
label="所在市" </Form.Item>
labelCol={{span:12}} <Form.Item
name="cityId" label="联系人"
initialValue={placeInfo?.cityName !== '全部' ? placeInfo?.cityName : null} name="contactName"
// rules={[{ required: true, message: '请选择所在市' }]} rules={[{
> required: true,
<Select labelInValue options={cityList} placeholder={currentProvince?.current ? '全部' : '请选择'} onChange={handleCityChange}> message: '请填写联系人',
</Select> }
</Form.Item> ]}
</Col> initialValue={placeInfo?.contactName}
<Col span={8}> >
<Form.Item <Input placeholder="请填写联系人" maxLength={20} />
label="所在县/区" </Form.Item>
labelCol={{span:12}} <Form.Item
name="countyId" label="联系电话"
initialValue={placeInfo?.countyName !== '全部' ? placeInfo?.countyName : null} name="contactTel"
// rules={[{ required: true, message: '请选择所在县/区' }]} rules={[{
> required: true,
<Select labelInValue options={areaList} placeholder={(currentProvince?.current !== null || currentCity?.current !== null) ? '全部' : '请选择'} onChange={handleCountyChange}> message: '请填写联系电话',
</Select> },
</Form.Item> {
</Col> pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
</Row> message: '输入的联系电话不正确',
}
<Form.Item ]}
label="详细地址" initialValue={placeInfo?.contactTel}
name="placeAddress" >
rules={[{ <Input placeholder="请填写联系电话" maxLength={20} />
required: true, </Form.Item>
message: '请填写详细地址', </Form>
}, </Spin>
{ </Modal><SelectExternPlaceModal modalVisible={selectPlaceStatus} onCancel={() => setSelectPlaceStatus(false)} onSubmit={(value: any) => selectPlaceCallBack(value)} values={currentPlatform?.current}> </SelectExternPlaceModal></>
max: 100, )
message: '最大不能超过100字'
}
]}
initialValue={placeInfo?.placeAddress}
>
<Input placeholder="请填写详细地址"/>
</Form.Item>
<Form.Item
label="联系人"
name="contactName"
rules={[{
required: true,
message: '请填写联系人',
},
{
max: 20,
message: '最大不能超过20字'
}
]}
initialValue={placeInfo?.contactName}
>
<Input placeholder="请填写联系人"/>
</Form.Item>
<Form.Item
label="联系电话"
name="contactTel"
rules={[{
required: true,
message: '请填写联系电话',
},
{
pattern: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
message: '输入的联系电话不正确',
},
{
max: 20,
message: '最大不能超过20字'
}
]}
initialValue={placeInfo?.contactTel}
>
<Input placeholder="请填写联系电话"/>
</Form.Item>
</Form>
</Spin>
</Modal>)
}) })
export default PlaceModal; export default PlaceModal;

View File

@ -0,0 +1,135 @@
import React, { useEffect, useRef, useState } from 'react';
import { Button, message, Modal, Spin } from 'antd';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
import { getPlatAreaList } from '../../service';
interface SelectExternAreaProps {
modalVisible: boolean;
onCancel: () => void;
onSubmit: (value: any) => void;
values: any;
}
const SelectExternArea: React.FC<SelectExternAreaProps> = (props) => {
const { modalVisible, onCancel, onSubmit, values } = props;
const actionRef = useRef<ActionType>();
//当前选择行areaId
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
//当前选择行数据
const selectedRecord = useRef<any>();
//loading
const [loading, setLoading] = useState<boolean>(false);
const columns: ProColumns<any>[] = [
{
valueType: 'index',
width: 48,
},
{
title: '评标区域编码',
dataIndex: 'indexCode',
ellipsis: true,
hideInSearch: true,
},
{
title: '评标区域名称',
dataIndex: 'name',
ellipsis: true,
hideInSearch: true,
},
];
const onOk = () => {
if (selectedRowKeys.length == 0) {
message.info("请选择评标区域");
return;
}
onSubmit(selectedRecord?.current);
onCancel();
}
useEffect(() => {
setSelectedRowKeys([]);
selectedRecord.current = null;
}, [values])
const queryExternAreaList = async () => {
console.log(values);
setLoading(true);
return await getPlatAreaList({placeId: values}).then(res => {
if (res?.code == 200) {
return {
data: res?.data,
success: res?.success
}
} else {
return {
data: [],
success: false,
}
}
}).finally(()=>{
setLoading(false);
})
}
return (
<Modal
destroyOnClose
title={"选择评标区域"}
visible={modalVisible}
maskClosable={false}
onCancel={() => onCancel()}
onOk={() => onOk()}
okText={"确认"}
okButtonProps={{ loading: loading }}
width={"40%"}
bodyStyle={{ overflowY: 'auto', }}
className="confirm table-no-alert"
centered
footer = {[
<Button key="cancel" onClick={()=>{onCancel();}}>
</Button>,
<Button key="submit" type="primary" loading={loading} onClick={()=>{onOk();}}>
</Button>,
<Button
key="query"
type="primary"
loading={loading}
onClick={()=>{actionRef?.current?.reload();}}
>
</Button>,
]}
>
<Spin spinning={loading}>
<ProTable<any>
columns={columns}
actionRef={actionRef}
bordered={false}
request={async (params) => {
return queryExternAreaList();
}}
rowKey="indexCode"
search={false}
options={false}
pagination={false}
rowSelection={{
type: "radio",
selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRowKeys(selectedRowKeys);
selectedRecord.current = selectedRows[0];
},
}}
dateFormatter="string"
toolBarRender={false}
/>
</Spin>
</Modal>
);
};
export default SelectExternArea;

View File

@ -0,0 +1,135 @@
import React, { useEffect, useRef, useState } from 'react';
import { Button, message, Modal, Spin } from 'antd';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
import { getExternPlaces } from '../../service';
interface SelectExternPlaceProps {
modalVisible: boolean;
onCancel: () => void;
onSubmit: (value: any) => void;
values: any;
}
const SelectExternPlace: React.FC<SelectExternPlaceProps> = (props) => {
const { modalVisible, onCancel, onSubmit, values } = props;
const actionRef = useRef<ActionType>();
//当前选择行areaId
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
//当前选择行数据
const selectedRecord = useRef<any>();
//loading
const [loading, setLoading] = useState<boolean>(false);
const columns: ProColumns<any>[] = [
{
valueType: 'index',
width: 48,
},
{
title: '评标场所编码',
dataIndex: 'indexCode',
ellipsis: true,
hideInSearch: true,
},
{
title: '评标场所名称',
dataIndex: 'name',
ellipsis: true,
hideInSearch: true,
},
];
const onOk = () => {
if (selectedRowKeys.length == 0) {
message.info("请选择评标场所");
return;
}
onSubmit(selectedRecord?.current);
onCancel();
}
useEffect(() => {
setSelectedRowKeys([]);
selectedRecord.current = null;
}, [values])
const queryExternPlaceList = async () => {
console.log(values[0]?.platformId);
setLoading(true);
return await getExternPlaces({platformId:values[0]?.platformId}).then(res => {
if (res?.code == 200) {
return {
data: res?.data,
success: res?.success
}
} else {
return {
data: [],
success: false,
}
}
}).finally(()=>{
setLoading(false);
})
}
return (
<Modal
destroyOnClose
title={"选择评标场所"}
visible={modalVisible}
maskClosable={false}
onCancel={() => onCancel()}
onOk={() => onOk()}
okText={"确认"}
okButtonProps={{ loading: loading }}
width={"40%"}
bodyStyle={{ overflowY: 'auto', }}
className="confirm table-no-alert"
centered
footer = {[
<Button key="cancel" onClick={()=>{onCancel();}}>
</Button>,
<Button key="submit" type="primary" loading={loading} onClick={()=>{onOk();}}>
</Button>,
<Button
key="query"
type="primary"
loading={loading}
onClick={()=>{actionRef?.current?.reload();}}
>
</Button>,
]}
>
<Spin spinning={loading}>
<ProTable<any>
columns={columns}
actionRef={actionRef}
bordered={false}
request={async (params) => {
return queryExternPlaceList();
}}
rowKey="indexCode"
search={false}
options={false}
pagination={false}
rowSelection={{
type: "radio",
selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRowKeys(selectedRowKeys);
selectedRecord.current = selectedRows[0];
},
}}
dateFormatter="string"
toolBarRender={false}
/>
</Spin>
</Modal>
);
};
export default SelectExternPlace;