Merge branch 'master' of http://124.243.245.42:3000/sh/shz-admin
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled

This commit is contained in:
2026-07-03 13:19:53 +08:00
3 changed files with 36 additions and 20 deletions

View File

@@ -268,7 +268,7 @@ const PersonalCenter: React.FC = () => {
<section className="stats-section"> <section className="stats-section">
<Row gutter={0}> <Row gutter={0}>
<Col span={6}> <Col span={8}>
<div <div
className="stat-item" className="stat-item"
onClick={() => history.push('/job-portal/personal-center/applications')} onClick={() => history.push('/job-portal/personal-center/applications')}
@@ -277,7 +277,7 @@ const PersonalCenter: React.FC = () => {
<div className="stat-label"></div> <div className="stat-label"></div>
</div> </div>
</Col> </Col>
<Col span={6}> <Col span={8}>
<div <div
className="stat-item" className="stat-item"
onClick={() => history.push('/job-portal/personal-center/favorites')} onClick={() => history.push('/job-portal/personal-center/favorites')}
@@ -286,7 +286,7 @@ const PersonalCenter: React.FC = () => {
<div className="stat-label"></div> <div className="stat-label"></div>
</div> </div>
</Col> </Col>
<Col span={6}> <Col span={8}>
<div <div
className="stat-item" className="stat-item"
onClick={() => history.push('/job-portal/personal-center/footprints')} onClick={() => history.push('/job-portal/personal-center/footprints')}
@@ -295,12 +295,12 @@ const PersonalCenter: React.FC = () => {
<div className="stat-label"></div> <div className="stat-label"></div>
</div> </div>
</Col> </Col>
<Col span={6}> {/* <Col span={6}>
<div className="stat-item stat-item-last"> <div className="stat-item stat-item-last">
<div className="stat-number">{statistics.appointments}</div> <div className="stat-number">{statistics.appointments}</div>
<div className="stat-label">预约</div> <div className="stat-label">预约</div>
</div> </div>
</Col> </Col> */}
</Row> </Row>
</section> </section>

View File

@@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useAccess } from '@umijs/max';
import { Modal, Form, Input, DatePicker, Upload, Button, message, Row, Col, Select, Switch } from 'antd'; import { Modal, Form, Input, DatePicker, Upload, Button, message, Row, Col, Select, Switch } from 'antd';
import { UploadOutlined, DeleteOutlined } from '@ant-design/icons'; import { UploadOutlined, DeleteOutlined } from '@ant-design/icons';
import type { UploadFile } from 'antd/es/upload/interface'; import type { UploadFile } from 'antd/es/upload/interface';
@@ -17,6 +18,7 @@ interface EditModalProps {
} }
const EditModal: React.FC<EditModalProps> = ({ open, values, onCancel, onSubmit }) => { const EditModal: React.FC<EditModalProps> = ({ open, values, onCancel, onSubmit }) => {
const access = useAccess();
const [form] = Form.useForm(); const [form] = Form.useForm();
const [fileList, setFileList] = useState<UploadFile[]>([]); const [fileList, setFileList] = useState<UploadFile[]>([]);
const [uploading, setUploading] = useState(false); const [uploading, setUploading] = useState(false);
@@ -95,12 +97,14 @@ const EditModal: React.FC<EditModalProps> = ({ open, values, onCancel, onSubmit
const handleOk = async () => { const handleOk = async () => {
const formValues = await form.validateFields(); const formValues = await form.validateFields();
const { policyTag, publishTime, status, ...rest } = formValues; const { policyTag, publishTime, status, ...rest } = formValues;
const canChangeStatus = access.hasPerms('cms:policyInfo:status');
onSubmit({ onSubmit({
...rest, ...rest,
id: values?.id, id: values?.id,
publishTime: publishTime?.format('YYYY-MM-DD'), publishTime: publishTime?.format('YYYY-MM-DD'),
policyTag: Array.isArray(policyTag) ? policyTag.join(',') : policyTag, policyTag: Array.isArray(policyTag) ? policyTag.join(',') : policyTag,
status: status ? '0' : '1', // 有权限时取表单 Switch 值,无权限时保持原状态(新增默认启用,编辑保持原值)
status: canChangeStatus ? (status ? '0' : '1') : (values?.status || '0'),
}); });
}; };
@@ -208,11 +212,13 @@ const EditModal: React.FC<EditModalProps> = ({ open, values, onCancel, onSubmit
)} )}
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> {access.hasPerms('cms:policyInfo:status') && (
<Form.Item name="status" label="状态" valuePropName="checked" initialValue={true}> <Col span={12}>
<Switch checkedChildren="启用" unCheckedChildren="禁用" /> <Form.Item name="status" label="状态" valuePropName="checked" initialValue={true}>
</Form.Item> <Switch checkedChildren="启用" unCheckedChildren="禁用" />
</Col> </Form.Item>
</Col>
)}
<Col span={24}> <Col span={24}>
<Form.Item name="remark" label="备注"> <Form.Item name="remark" label="备注">
<TextArea rows={2} placeholder="请输入备注" /> <TextArea rows={2} placeholder="请输入备注" />

View File

@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { useAccess } from '@umijs/max'; import { useAccess } from '@umijs/max';
import { Button, message, Modal, Switch } from 'antd'; import { Button, message, Modal, Switch, Tag } from 'antd';
import { ActionType, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; import { ActionType, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
import { PlusOutlined, DeleteOutlined, FormOutlined, EyeOutlined } from '@ant-design/icons'; import { PlusOutlined, DeleteOutlined, FormOutlined, EyeOutlined } from '@ant-design/icons';
import { import {
@@ -137,14 +137,24 @@ const PolicyMgmt: React.FC = () => {
'1': { text: '禁用', status: 'Error' }, '1': { text: '禁用', status: 'Error' },
}, },
fixed: 'right', fixed: 'right',
render: (_, record) => ( render: (_, record) => {
<Switch const canChangeStatus = access.hasPerms('cms:policyInfo:status');
checked={record.status === '0'} if (canChangeStatus) {
checkedChildren="启用" return (
unCheckedChildren="禁用" <Switch
onChange={(checked) => handleStatusChange(record.id, checked)} checked={record.status === '0'}
/> checkedChildren="启用"
), unCheckedChildren="禁用"
onChange={(checked) => handleStatusChange(record.id, checked)}
/>
);
}
return (
<Tag color={record.status === '0' ? 'success' : 'error'}>
{record.status === '0' ? '启用' : '禁用'}
</Tag>
);
},
}, },
{ {
title: '创建时间', title: '创建时间',