10.25 增加预约人员会议室预约页面,原有预约管理增加操作项控制
This commit is contained in:
@ -5,6 +5,7 @@ import { cancelMeeting, getMeetingData, saveAppointmentEdit, saveMeeting } from
|
||||
import { isNotEmpty } from '@/utils/CommonUtils';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import { dateTimeFormatter, echoDateTimeFormatter } from '@/utils/DateUtils';
|
||||
import { getSessionRoleData, getSessionUserData } from '@/utils/session';
|
||||
|
||||
interface MeetingReservationProps {
|
||||
modalVisible: boolean;
|
||||
@ -12,7 +13,8 @@ interface MeetingReservationProps {
|
||||
onSubmit?: () => void;
|
||||
roomList?: any[];//评标室列表 带问号的参数可不传
|
||||
status: string;//状态 0-新建 1-编辑 2-查看
|
||||
meetId?: string;//预约id
|
||||
// meetId?: string;//预约id
|
||||
meetData: any;//预约数据
|
||||
}
|
||||
const layout = {
|
||||
labelCol: { span: 7 },
|
||||
@ -52,13 +54,18 @@ export const otherDisabledDateTime = (current: any, disabledMap: any, type: stri
|
||||
};
|
||||
//时间选择框日期格式化
|
||||
export const dateFormat: DatePickerProps['format'] = value => value?.startOf('hour').format('YYYY-MM-DD HH:mm:ss');
|
||||
//获取登录账号
|
||||
const userId = getSessionUserData()?.userId;
|
||||
//获取角色
|
||||
const roleCode = getSessionRoleData()?.roleCode;
|
||||
/**
|
||||
* 评标室预约管理-会议室预约弹窗
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
const MeetingReservation: React.FC<MeetingReservationProps> = (props) => {
|
||||
const { modalVisible, onCancel, onSubmit, roomList, status, meetId } = props;
|
||||
const { modalVisible, onCancel, onSubmit, roomList, status, meetData } = props;
|
||||
const { id = null, reserveBy = "" } = { ...meetData };
|
||||
const [form] = Form.useForm();
|
||||
const { Option } = Select;
|
||||
const { confirm } = Modal;
|
||||
@ -75,6 +82,8 @@ const MeetingReservation: React.FC<MeetingReservationProps> = (props) => {
|
||||
const [isEditMeet, setIsEditMeet] = useState<boolean>(false);
|
||||
//存一份预约数据
|
||||
const [meetingData, setMeetingData] = useState<any>();
|
||||
//判断预约人员是否本人 true-是预约人员不是本人(不可编辑) false-其余情况(可以编辑)
|
||||
const isMeetSelf: boolean = (roleCode == "ebtp-appointment") && (reserveBy != userId);
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
if (values.reserveStartDate < moment().format(dateTimeFormatter)) {
|
||||
@ -109,7 +118,7 @@ const MeetingReservation: React.FC<MeetingReservationProps> = (props) => {
|
||||
//获取预约信息
|
||||
const getMeetData = () => {
|
||||
setSkeleing(true);
|
||||
getMeetingData(meetId).then(res => {
|
||||
getMeetingData(id).then(res => {
|
||||
if (res?.code == 200) {
|
||||
setSkeleing(false);
|
||||
const data = res?.data;
|
||||
@ -134,7 +143,7 @@ const MeetingReservation: React.FC<MeetingReservationProps> = (props) => {
|
||||
okText: '确认',
|
||||
content: '',
|
||||
async onOk() {
|
||||
await cancelMeeting(meetId).then(res => {
|
||||
await cancelMeeting(id).then(res => {
|
||||
if (res?.code == 200) {
|
||||
message.success("取消预约成功");
|
||||
onSubmit && onSubmit();
|
||||
@ -155,10 +164,10 @@ const MeetingReservation: React.FC<MeetingReservationProps> = (props) => {
|
||||
setModalStatus("1");
|
||||
}
|
||||
useEffect(() => {
|
||||
if (isNotEmpty(meetId)) {
|
||||
if (isNotEmpty(id)) {
|
||||
getMeetData();
|
||||
}
|
||||
}, [meetId])
|
||||
}, [id])
|
||||
|
||||
return (
|
||||
<Modal
|
||||
@ -175,10 +184,10 @@ const MeetingReservation: React.FC<MeetingReservationProps> = (props) => {
|
||||
<Button key="save" type="primary" onClick={() => form.submit()} hidden={meetType == undefined || modalStatus == "2"}>
|
||||
保存
|
||||
</Button>,
|
||||
<Button key="edit" onClick={() => editMeeting()} hidden={meetType == undefined || modalStatus == "1" || modalStatus == "0" || isEditMeet}>
|
||||
<Button key="edit" onClick={() => editMeeting()} hidden={meetType == undefined || modalStatus == "1" || modalStatus == "0" || isEditMeet || isMeetSelf}>
|
||||
修改预约
|
||||
</Button>,
|
||||
<Button type="primary" key="cancel" hidden={modalStatus == "0"} onClick={() => cancelMeet()}>
|
||||
<Button type="primary" key="cancel" hidden={modalStatus == "0" || isEditMeet || isMeetSelf} onClick={() => cancelMeet()}>
|
||||
取消预约
|
||||
</Button>,
|
||||
]}
|
||||
|
Reference in New Issue
Block a user