import React, { Fragment, PureComponent } from 'react'; import { DeleteOutlined, EditOutlined, PlusOutlined, SearchOutlined, RedoOutlined, DownOutlined, ExclamationCircleFilled, UpOutlined, SafetyOutlined, ImportOutlined, ExportOutlined, UserOutlined, TeamOutlined, SettingOutlined, FileTextOutlined, ProjectOutlined, WarningOutlined, AlertOutlined, } from '@ant-design/icons'; import { connect, history } from '@umijs/max'; import { Button, Card, Divider, Dropdown, message, Modal, Popconfirm, Space, Switch, Tag, Row, Col, Tabs, Tree, Progress, Input, Select } from 'antd'; import StandardTable from '@/components/StandardTable'; import ReactECharts from 'echarts-for-react'; import { MyIcon } from "@/components/Icon" import style from "@/global.less"; import StaffSheetCreateForm from './form/BasicInfoCreateForm'; //新增表单 import StaffSheetUpdateForm from './form/BasicInfoUpdateForm'; //修改表单 import StaffSheetViewForm from './form/BasicInfoViewForm'; //查看表单 import styles from './BasicInformation.less'; import datadictionary from "@/utils/dataDictionary"; import { formatDate } from "@/utils/formatUtils"; import { formatDictText, checkButtonAuthority } from "@/utils/globalCommon"; const { confirm } = Modal; //预约类型 const sex_type = datadictionary.sex const user_status = datadictionary.user_status const sys_user_post = datadictionary.sys_user_post const mockData = { list: [ { id: '01', projectName: '安全项目一', location: '北京朝阳区', area: '15,000m²', organization: '安全生产部', staffCount: 168, safetyLevel: '高', }, { id: '02', projectName: '安全项目二', location: '北京朝阳区', area: '15,000m²', organization: '安全生产部', staffCount: 168, safetyLevel: '中', }, { id: '03', projectName: '安全项目三', location: '北京朝阳区', area: '15,000m²', organization: '安全生产部', staffCount: 168, safetyLevel: '低', }, { id: '04', projectName: '安全项目四', location: '北京朝阳区', area: '15,000m²', organization: '安全生产部', staffCount: 168, safetyLevel: '低', }, { id: '05', projectName: '安全项目五', location: '北京朝阳区', area: '15,000m²', organization: '安全生产部', staffCount: 168, safetyLevel: '中', }, ], pagination: { total: 48, current: 1, pageSize: 5, }, } // 组织架构树形数据 const treeData = [ { title: '安全部', key: '0-0', icon: , children: [ { title: '安全管理科', key: '0-0-0', icon: , }, { title: '生产科', key: '0-0-1', icon: , }, { title: '设备科', key: '0-0-2', icon: , }, ], }, ]; @connect(({ staffsheet, loading }) => ({ staffsheet, loading: loading.models.staffsheet, })) class BasicInformation extends PureComponent { state = { modalVisible: false, updateModalVisible: false, viewModalVisible: false, expandForm: false, selectedRows: [], formValues: {}, updateFormValues: {}, viewFormValues: {}, toggleExpand: false, activeTab: '1', } columns = [ { title: '编号', dataIndex: 'id', key: 'id', width: 80, fixed: 'left', }, { title: '项目名称', dataIndex: 'projectName', key: 'projectName', width: 150, fixed: 'left', }, { title: '地理信息', dataIndex: 'location', key: 'location', width: 120, }, { title: '占地面积', dataIndex: 'area', key: 'area', width: 100, }, { title: '组织机构', dataIndex: 'organization', key: 'organization', width: 120, }, { title: '职业人数', dataIndex: 'staffCount', key: 'staffCount', width: 100, render: (text) => `${text} 人`, }, { title: '安全等级', dataIndex: 'safetyLevel', key: 'safetyLevel', width: 100, render: (text) => { let color = 'green'; if (text === '高') color = 'red'; else if (text === '中') color = 'orange'; return {text}; }, }, { title: '操作', fixed: 'right', align: 'center', width: 200, render: (text, record) => { return ( 详情 修改 删除 ) } }, ] componentDidMount() { // 初始化页面数据 } getPieChartOption = () => { return { tooltip: { trigger: 'item', formatter: '{a}
{b}: {c}% ({d}%)' }, legend: { orient: 'vertical', right: '25%', top: '25%', itemWidth: 14, itemHeight: 14, itemGap: 20, textStyle: { fontSize: 14, color: '#333', fontWeight: 'normal' } }, series: [ { name: '功能区域占比', type: 'pie', radius: ['30%', '45%'], center: ['30%', '45%'], avoidLabelOverlap: false, label: { show: false }, emphasis: { scale: true, scaleSize: 5 }, labelLine: { show: false }, data: [ { value: 45, name: '生产区', itemStyle: { color: '#4A90E2' } }, { value: 20, name: '仓储区', itemStyle: { color: '#7ED321' } }, { value: 20, name: '办公区', itemStyle: { color: '#9B59B6' } }, { value: 15, name: '辅助区', itemStyle: { color: '#F5A623' } } ] } ] }; } handleStandardTableChange = (pagination, sorter) => { const { dispatch } = this.props const { formValues } = this.state const params = { currentPage: pagination.current, pageSize: pagination.pageSize, ...formValues } sorter.field && (params.sorter = `${sorter.field}_${sorter.order}`) // dispatch({ // type: 'prouser/query_page_for_prouser', // payload: params // }) } handleFormReset = () => { const { dispatch } = this.props this.setState({ formValues: {} }) // dispatch({ // type: 'prouser/query_page_for_prouser', // payload: { // resetFlag: true // } // }) } toggleForm = () => { const { expandForm } = this.state this.setState({ expandForm: !expandForm }) } handleSelectRows = rows => { this.setState({ selectedRows: rows }) } handleSearch = values => { const { dispatch } = this.props const { expandForm } = this.state this.setState({ formValues: values }) // dispatch({ // type: 'prouser/query_page_for_prouser', // payload: { // ...values, // resetFlag: true, // expandForm // } // }) } handleModalVisible = flag => { this.setState({ modalVisible: !!flag }) } handleUpdateModalVisible = (flag, record) => { this.setState({ updateModalVisible: !!flag, updateFormValues: record || {} }) } handleViewModalVisible = (flag, record) => { this.setState({ viewModalVisible: !!flag, viewFormValues: record || {} }) } handleAdd = fields => { const { dispatch } = this.props dispatch({ type: 'prouser/insert_for_prouser', payload: { user_id: fields.user_id, user_name: fields.user_name, user_name_cn: fields.user_name_cn, user_name_en: fields.user_name_en, password: fields.password, email: fields.email, phone: fields.phone, landline: fields.landline, sex: fields.sex, avatar: fields.avatar, sign: fields.sign, tags: fields.tags, id_card: fields.id_card, birthday: fields.birthday, job_status: fields.job_status, hiredate: fields.hiredate, departure_time: fields.departure_time, user_type: fields.user_type, emp_no: fields.emp_no, access_card_no: fields.access_card_no, country: fields.country, province: fields.province, city: fields.city, address: fields.address, work_addr: fields.work_addr, floor: fields.floor, inprovince: fields.inprovince, // dept_code: fields.dept_code, // dept_name: fields.dept_name, inner_dept_code: fields.inner_dept_code, org_code: fields.org_code, org_name: fields.org_name, inner_org_code: fields.inner_org_code, posts: fields.posts, wx_openid: fields.wx_openid, wx_mpopenid: fields.wx_mpopenid, wx_miniopenid: fields.wx_miniopenid, wx_unionid: fields.wx_unionid, mobile_imei: fields.mobile_imei, device_num: fields.device_num, al_taobao: fields.al_taobao, al_alipay: fields.al_alipay, al_dingding: fields.al_dingding, is_system_user: fields.is_system_user, mgr_type: fields.mgr_type, pwd_security_level: fields.pwd_security_level, pwd_update_date: fields.pwd_update_date, last_login_ip: fields.last_login_ip, last_login_date: fields.last_login_date, freeze_date: fields.freeze_date, freeze_cause: fields.freeze_cause, zindex: fields.zindex, wx_msg: fields.wx_msg, email_msg: fields.email_msg, system_msg: fields.system_msg, remarks: fields.remarks, status: fields.status, creator: fields.creator, create_date: fields.create_date, updater: fields.updater, update_date: fields.update_date }, callback: (res) => { if (res.success == true) { message.success('添加成功') this.handleModalVisible() } } }) } handleDeleteRecord = record => { const { dispatch } = this.props dispatch({ type: 'prouser/delete_by_primarykey_for_prouser', payload: { recordid: record.user_id }, callback: res => { if (res.success) { message.success('删除成功') this.setState({ selectedRows: [] }) } } }) } handleUpdate = fields => { const { dispatch } = this.props dispatch({ type: 'prouser/update_for_prouser', payload: { user_id: fields.user_id, user_name: fields.user_name, user_name_cn: fields.user_name_cn, user_name_en: fields.user_name_en, password: fields.password, email: fields.email, phone: fields.phone, landline: fields.landline, sex: fields.sex, avatar: fields.avatar, sign: fields.sign, tags: fields.tags, id_card: fields.id_card, birthday: fields.birthday, job_status: fields.job_status, hiredate: fields.hiredate, departure_time: fields.departure_time, user_type: fields.user_type, emp_no: fields.emp_no, access_card_no: fields.access_card_no, country: fields.country, province: fields.province, city: fields.city, address: fields.address, work_addr: fields.work_addr, floor: fields.floor, inprovince: fields.inprovince, // dept_code: fields.dept_code, // dept_name: fields.dept_name, inner_dept_code: fields.inner_dept_code, org_code: fields.org_code, org_name: fields.org_name, inner_org_code: fields.inner_org_code, posts: fields.posts, wx_openid: fields.wx_openid, wx_mpopenid: fields.wx_mpopenid, wx_miniopenid: fields.wx_miniopenid, wx_unionid: fields.wx_unionid, mobile_imei: fields.mobile_imei, device_num: fields.device_num, al_taobao: fields.al_taobao, al_alipay: fields.al_alipay, al_dingding: fields.al_dingding, is_system_user: fields.is_system_user, mgr_type: fields.mgr_type, pwd_security_level: fields.pwd_security_level, pwd_update_date: fields.pwd_update_date, last_login_ip: fields.last_login_ip, last_login_date: fields.last_login_date, freeze_date: fields.freeze_date, freeze_cause: fields.freeze_cause, zindex: fields.zindex, wx_msg: fields.wx_msg, email_msg: fields.email_msg, system_msg: fields.system_msg, remarks: fields.remarks, status: fields.status, creator: fields.creator, create_date: fields.create_date, updater: fields.updater, update_date: fields.update_date }, callback: (res) => { if (res.success === true) { message.success('修改成功') this.handleUpdateModalVisible() } } }) } // 修改用户状态 handleUpdateUserStatus = (fields, status, msg) => { const { dispatch } = this.props confirm({ title: `确定要 ${msg} 当前用户的吗?`, icon: , onOk() { dispatch({ type: 'prouser/update_for_prouser', payload: { user_id: fields.user_id, status: status, }, callback: (res) => { if (res.success === true) { message.success('修改成功') } } }) } }) } // 修改用户密码 handleUpdateUserPassword = fields => { const { dispatch } = this.props confirm({ title: '确定要重置当前用户的密码吗?', icon: , onOk() { dispatch({ type: 'prouser/resetpwd_for_prouser', payload: { user_id: fields.user_id }, callback: (res) => { if (res.success === true) { message.success('重置成功') } } }) } }) } handleCollapse = () => { const { toggleExpand } = this.state this.setState({ toggleExpand: !toggleExpand }) } render() { const { staffsheet: { data, selectDeptTree, selectOrganTree }, loading, dispatch } = this.props const { selectedRows, modalVisible, updateModalVisible, viewModalVisible, updateFormValues, viewFormValues, toggleExpand, activeTab } = this.state const parentMethods = { handleAdd: this.handleAdd, handleModalVisible: this.handleModalVisible, dispatch: dispatch, loading, selectDeptTree: selectDeptTree, selectOrganTree: selectOrganTree } const updateMethods = { handleUpdateModalVisible: this.handleUpdateModalVisible, handleUpdate: this.handleUpdate, dispatch: dispatch, loading, selectDeptTree: selectDeptTree, selectOrganTree: selectOrganTree } const viewMethods = { handleViewModalVisible: this.handleViewModalVisible } const tabItems = [ { key: '1', label: '基本信息管理', }, { key: '2', label: '资质证照管理', }, { key: '3', label: '人员基础信息', } ]; return (
{/* 顶部标签页 */}
this.setState({ activeTab: key })} items={tabItems} className="custom-tabs" style={{ marginBottom: 0 }} />
{/* 主要内容区域 */} {/* 左侧:组织机构人员管理 */}
组织机构与人员管理
{/* 组织架构图 */}
{/* 顶部按钮 */}
{/* 连接线 - 顶部到第一层 */}
{/* 第一层水平连接线 */}
{/* 第一层垂直连接线 */}
{/* 第一层部门 */}
安监部
{/* 安监部连接线 */}
生产部
{/* 生产部连接线 */}
设备部
{/* 设备部连接线 */}
{/* 第二层子部门 */}
{/* 安监部子部门 */}
安全监督科
风险评估科
{/* 生产部子部门 */}
生产调度科
现场管理科
{/* 设备部子部门 */}
设备维护科
备件管理科
{/* 中间:功能区域占比 */}
功能区面积占比
{/* 右侧:实时风险评估 */}
{/* 顶部装饰性背景层 */}
{/* 底部装饰性背景层 */}
{/* 标题 */}
实时风险评估
{/* 主要内容区域 */}
{/* 左侧盾牌图标 */}
{/* 3D效果的底座 */}
{/* 右侧内容 */}
{/* 风险等级提示框 */}
当前风险等级: 重大风险
{/* 提示信息 */}
💡
提示:安全等级分为 红、橙、黄、蓝四级,当前风险等级为红区,存在重大风险
{/* 底部表格区域 */}