Merge branch 'master-电子评标室-现场人员管理-zyx' into 'release_electronic_bid_evaluation_room'
8.26 电子评标室 现场人员管理 zyx See merge request eshop/fe_service_ebtp_frontend!250
This commit is contained in:
180
src/pages/SitePerson/components/SitePersonModal.tsx
Normal file
180
src/pages/SitePerson/components/SitePersonModal.tsx
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { Form, Input, Modal, Spin, Select, Button, Radio, RadioChangeEvent } from 'antd';
|
||||||
|
import ExtendUpload from "@/utils/ExtendUpload";
|
||||||
|
import { getFileListByBid } from '@/utils/DownloadUtils';
|
||||||
|
|
||||||
|
|
||||||
|
interface SitePersonModalProps {
|
||||||
|
title: any;
|
||||||
|
modalVisible: boolean;
|
||||||
|
formDisabled: boolean;
|
||||||
|
values: any;
|
||||||
|
onSubmit: any;
|
||||||
|
type: string;
|
||||||
|
onCancel: () => void;
|
||||||
|
placeList: any[];
|
||||||
|
}
|
||||||
|
const layout = {
|
||||||
|
labelCol: { span: 7 },
|
||||||
|
wrapperCol: { span: 12 },
|
||||||
|
};
|
||||||
|
const SitePersonModal: React.FC<SitePersonModalProps> = (props) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
// const weboffice = useRef<Weboffice>(null);
|
||||||
|
const { title, modalVisible, formDisabled, type, values, onSubmit: handleUpdate, onCancel, placeList } = props;
|
||||||
|
//loading
|
||||||
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
const [value, setValue] = useState<string>("1");
|
||||||
|
|
||||||
|
const onChange = (e: RadioChangeEvent) => {
|
||||||
|
console.log('radio checked', e.target.value);
|
||||||
|
setValue(e.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (JSON.stringify(values) !== "{}") {
|
||||||
|
form.setFieldsValue({
|
||||||
|
"id": values.id,
|
||||||
|
"evalPlaceId": {label: values.eroomName,value: values.evalPlaceId},
|
||||||
|
"facePic": values.facePic,
|
||||||
|
"sex": values.sex,
|
||||||
|
"personName": values.personName,
|
||||||
|
"identityCard": values.identityCard
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [values])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const onOk = async () => {
|
||||||
|
const fieldsValue = await form.validateFields();
|
||||||
|
setLoading(true)
|
||||||
|
fieldsValue["evalPlaceId"] = fieldsValue.evalPlaceId.value
|
||||||
|
console.log(fieldsValue)
|
||||||
|
|
||||||
|
await getFileListByBid(fieldsValue.facePic).then(res => {
|
||||||
|
fieldsValue["facePicName"] = res[0].name
|
||||||
|
})
|
||||||
|
console.log(fieldsValue)
|
||||||
|
await handleUpdate({ ...fieldsValue }).finally(() => {
|
||||||
|
setLoading(false)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const renderFooter = () => {
|
||||||
|
if (type == "read") {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button onClick={onCancel}>关闭</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button type="primary" loading={loading} onClick={onOk}>确认</Button>
|
||||||
|
<Button onClick={onCancel}>取消</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
destroyOnClose={true}
|
||||||
|
title={title}
|
||||||
|
visible={modalVisible}
|
||||||
|
onCancel={() => onCancel()}
|
||||||
|
width={"60%"}
|
||||||
|
centered
|
||||||
|
footer={renderFooter()}
|
||||||
|
>
|
||||||
|
<Spin spinning={loading}>
|
||||||
|
<Form
|
||||||
|
{...layout}
|
||||||
|
name="nest-messages"
|
||||||
|
form={form}
|
||||||
|
preserve={false}
|
||||||
|
>
|
||||||
|
<Form.Item name="id" label="id" hidden>
|
||||||
|
<Input hidden />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="evalPlaceId" label="选择评标场所" >
|
||||||
|
<Select placeholder="请选择评标场所" labelInValue disabled={formDisabled}>
|
||||||
|
{
|
||||||
|
placeList.map((item: any, index: any) => {
|
||||||
|
return (
|
||||||
|
<Select.Option value={item.id}>{item.placeName}</Select.Option>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label="人员姓名"
|
||||||
|
name="personName"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '当前项不可为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="身份证号"
|
||||||
|
name="identityCard"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '当前项不可为空',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
|
||||||
|
message: '输入的身份证号不正确',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="性别"
|
||||||
|
name="sex"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '当前项不可为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{/* 1-男性,2-女性 */}
|
||||||
|
<Radio.Group onChange={onChange} value={value}>
|
||||||
|
<Radio value="1">男性</Radio>
|
||||||
|
<Radio value="2">女性 </Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="人脸照片"
|
||||||
|
name="facePic"
|
||||||
|
extra="请上传清晰人脸正面照片,要求.jpg格式图片,文件大下不得超过60kb"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '当前项不可为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ExtendUpload bid={values.facePic} btnName="上传" maxCount={1} maxSize={0.057} uploadProps={{ accept: ".jpg" }}>
|
||||||
|
{/* maxSize={0.057} */}
|
||||||
|
</ExtendUpload>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Spin>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SitePersonModal;
|
203
src/pages/SitePerson/index.tsx
Normal file
203
src/pages/SitePerson/index.tsx
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
import ProTable, { ActionType } from '@ant-design/pro-table';
|
||||||
|
import { getList, saveSitePerson, delSitePerson, getPlaceList } from './service';
|
||||||
|
import { Button, Card, Form, message, Spin, Popconfirm } from 'antd';
|
||||||
|
import SitePersonModal from './components/SitePersonModal';
|
||||||
|
import { downloadFileObjectId } from '@/utils/DownloadUtils';
|
||||||
|
|
||||||
|
|
||||||
|
const SitePersonList: React.FC<{}> = () => {
|
||||||
|
const checkRelationRef = useRef<ActionType>(); //操作数据后刷新列表
|
||||||
|
const [isEditModalVisible, setIsEditModalVisible] = useState<boolean>(false) //控制新增或编辑模态框是否显示
|
||||||
|
const [form] = Form.useForm();//新增模块form
|
||||||
|
// const [editForm] = Form.useForm();//编辑模块form
|
||||||
|
//单条数据
|
||||||
|
const [editForm, setEditForm] = useState<any>({});
|
||||||
|
const [spinning, setSping] = useState<boolean>(false);//加载遮罩
|
||||||
|
const [placeList, setPlaceList] = useState<any>([]); //省分公司信息
|
||||||
|
//下拉框是否可编辑
|
||||||
|
const [placeFormDisabled, setPlaceFormDisabled] = useState<any>(false);
|
||||||
|
const [type, setType] = useState<any>('cease');//弹窗类型
|
||||||
|
let typename = "新增";
|
||||||
|
|
||||||
|
|
||||||
|
const columns: any = [
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
valueType: 'index',
|
||||||
|
width: 80,
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '评标场所编号',
|
||||||
|
// dataIndex: 'eroomNum',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '评标场所名称',
|
||||||
|
dataIndex: 'eroomName',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '人员类型',
|
||||||
|
// dataIndex: 'bank',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '人员姓名',
|
||||||
|
dataIndex: 'personName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '身份证号',
|
||||||
|
dataIndex: 'identityCard',
|
||||||
|
width: 300,
|
||||||
|
ellipsis: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '人脸照片',
|
||||||
|
dataIndex: 'facePicName',
|
||||||
|
search: false,
|
||||||
|
render: (text: any, record: any) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<a onClick={() => downloadFileObjectId(record.facePic)}>{record.facePicName}</a>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
search: false,
|
||||||
|
render: (text: any, record: any) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<a onClick={() => setFormVals(record)}>编辑</a>
|
||||||
|
<Popconfirm placement="topRight" title={"确定删除么?"} onConfirm={async () => { delPerson(record.id); }} okText="确定" cancelText="取消" ><a > 删除 </a></Popconfirm>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const delPerson = (id: any) => { // 删除
|
||||||
|
setSping(true);
|
||||||
|
delSitePerson(id).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
setSping(false);
|
||||||
|
message.success('删除成功');
|
||||||
|
checkRelationRef.current?.reload();
|
||||||
|
} else {
|
||||||
|
setSping(false);
|
||||||
|
form.resetFields()
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
setSping(false);
|
||||||
|
});;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑页面赋值
|
||||||
|
const setFormVals = (item: any) => {
|
||||||
|
typename = "编辑";
|
||||||
|
setEditForm(item);
|
||||||
|
setType("edit");
|
||||||
|
setIsEditModalVisible(true)
|
||||||
|
setSping(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增页面
|
||||||
|
const insertSitePerson = () => {
|
||||||
|
setType("insert");
|
||||||
|
setIsEditModalVisible(true)
|
||||||
|
setSping(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
//查询当前人员权限下所有评标场所
|
||||||
|
getPlaceList().then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
setPlaceList(res.data)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Spin spinning={spinning}>
|
||||||
|
<Card title="评标场所人员管理">
|
||||||
|
|
||||||
|
<ProTable
|
||||||
|
actionRef={checkRelationRef}
|
||||||
|
columns={columns}
|
||||||
|
options={false}
|
||||||
|
size='small'
|
||||||
|
search={{
|
||||||
|
labelWidth: 100,
|
||||||
|
// defaultCollapsed: false,//是否展开搜索条件
|
||||||
|
optionRender: (searchConfig, formProps, dom) => [
|
||||||
|
...dom.reverse(),
|
||||||
|
<Button key="out" type="primary" onClick={() => insertSitePerson()}>
|
||||||
|
新增
|
||||||
|
</Button>,
|
||||||
|
],
|
||||||
|
}}
|
||||||
|
|
||||||
|
request={(params) => {
|
||||||
|
let trueParams = {
|
||||||
|
...params,
|
||||||
|
pageNo: params.current,
|
||||||
|
}
|
||||||
|
return new Promise<any>((resolve, reject) => {
|
||||||
|
getList(trueParams).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
resolve({
|
||||||
|
data: res.data.records,
|
||||||
|
success: res.success,
|
||||||
|
total: res.data.total,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
resolve({
|
||||||
|
data: [],
|
||||||
|
success: false,
|
||||||
|
total: 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
pagination={{ defaultPageSize: 10, showSizeChanger: false }}//默认显示条数
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
{/* 新增及编辑银行账号Modal */}
|
||||||
|
{
|
||||||
|
isEditModalVisible ?
|
||||||
|
<SitePersonModal
|
||||||
|
title={typename+"人员信息"}
|
||||||
|
type={type}
|
||||||
|
modalVisible={isEditModalVisible}
|
||||||
|
formDisabled={placeFormDisabled}
|
||||||
|
placeList={placeList}
|
||||||
|
values={editForm}
|
||||||
|
onSubmit={async (value: any) => {
|
||||||
|
await saveSitePerson(value).then((res: any) => {
|
||||||
|
if (res.success === true) {
|
||||||
|
message.success("保存成功!");
|
||||||
|
setIsEditModalVisible(false);
|
||||||
|
setEditForm({});
|
||||||
|
// getSitePerson();
|
||||||
|
checkRelationRef.current?.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsEditModalVisible(!isEditModalVisible);
|
||||||
|
setEditForm({});
|
||||||
|
}}
|
||||||
|
></SitePersonModal>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
|
||||||
|
</Spin>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SitePersonList;
|
40
src/pages/SitePerson/service.ts
Normal file
40
src/pages/SitePerson/service.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
/**
|
||||||
|
* 查询数据并分页
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export async function getList(params?: any) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/room/site/person/page', {
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function getPlaceList() { // 列表
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/elec/eval/place/userlimit/list', {
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export async function saveSitePerson(data?: any) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/room/site/person/save', {
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export async function delSitePerson(id?: any) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/room/site/person/delete?id='+id, {
|
||||||
|
method: 'post',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user