|
@@ -0,0 +1,145 @@
|
|
|
+import { useEffect, useState } from 'react';
|
|
|
+import { useSelector } from 'react-redux'
|
|
|
+import { Table, Modal, message, Menu, Breadcrumb, Dropdown, Space, Form, Radio, Input, Button, Tabs, Row, Col, Select } from 'antd';
|
|
|
+import { DownOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
+import Quill from '@common/QuillEditor';
|
|
|
+import SelectedTag from '@common/SelectedTag.js';
|
|
|
+import UserList from './UserList';
|
|
|
+import DeptTree from './DeptTree';
|
|
|
+import './index.less';
|
|
|
+import "quill/dist/quill.core.css";
|
|
|
+import "quill/dist/quill.snow.css";
|
|
|
+import backIcon from "@images/back.png";
|
|
|
+import apiObj from '@api/index';
|
|
|
+import utils from '@utils/index'
|
|
|
+const { post, api, xPost } = apiObj;
|
|
|
+const { Option } = Select;
|
|
|
+const { TabPane } = Tabs;
|
|
|
+function AddNewMsg() {
|
|
|
+ const [form] = Form.useForm();
|
|
|
+ const initialValues={receiveType:0,type:1};
|
|
|
+ const [showCustom,setShowCustom] = useState(false);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ /*var toolbarOptions = [
|
|
|
+ ['bold', 'italic', 'underline', 'strike'], // toggled buttons
|
|
|
+ ['blockquote', 'code-block'],
|
|
|
+
|
|
|
+ [{ 'header': 1 }, { 'header': 2 }], // custom button values
|
|
|
+ [{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
|
|
+ [{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
|
|
|
+ [{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
|
|
|
+ [{ 'direction': 'rtl' }], // text direction
|
|
|
+
|
|
|
+ [{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
|
|
|
+ [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
|
|
|
+
|
|
|
+ [{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
|
|
|
+ [{ 'font': [] }],
|
|
|
+ [{ 'align': [] }],
|
|
|
+
|
|
|
+ ['clean'], // remove formatting button
|
|
|
+ ['chord'],
|
|
|
+ ['play']
|
|
|
+ ];
|
|
|
+ const editor = document.getElementById('editor');
|
|
|
+ let quill = new Quill(editor,{
|
|
|
+ modules:{
|
|
|
+ toolbar: {
|
|
|
+ container: [['bold', 'italic'], ['link', 'image']],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ theme:'snow'
|
|
|
+ });*/
|
|
|
+ //刷新列表
|
|
|
+ getUserData();
|
|
|
+
|
|
|
+ }, []);
|
|
|
+ function getUserData(){
|
|
|
+ post(api.getHospitalUser, {}).then((res) => {
|
|
|
+ const { code } = res.data;
|
|
|
+ if (code === 200) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ message.warning(res.data.msg || '获取用户列表失败,请重试')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //返回通知管理页
|
|
|
+ function goBack(){
|
|
|
+
|
|
|
+ }
|
|
|
+ //发送消息
|
|
|
+ function sendMsg(){
|
|
|
+ console.log(form.getFieldsValue())
|
|
|
+ }
|
|
|
+ //类型切换
|
|
|
+ function onTypeChange(){
|
|
|
+
|
|
|
+ }
|
|
|
+ //接收者类型切换
|
|
|
+ function onReceiveTypeChange(e){
|
|
|
+ const val = e.target.value;
|
|
|
+ setShowCustom(val===1);
|
|
|
+ }
|
|
|
+ //切换tab
|
|
|
+ function handleTabChange(){
|
|
|
+
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Breadcrumb separator="">
|
|
|
+ <Breadcrumb.Item><img className='back-icon' src={backIcon} onClick={goBack} alt="返回上一页" /></Breadcrumb.Item>
|
|
|
+ <Breadcrumb.Item>通知管理</Breadcrumb.Item>
|
|
|
+ <Breadcrumb.Separator />
|
|
|
+ <Breadcrumb.Item>新增通知</Breadcrumb.Item>
|
|
|
+ </Breadcrumb>
|
|
|
+ <div className='add-msg-container'>
|
|
|
+ <Form form={form}
|
|
|
+ initialValues={initialValues}
|
|
|
+ labelCol={{ span: 2 }}
|
|
|
+ layout="horizontal">
|
|
|
+ <Form.Item name='type' label='类型' required>
|
|
|
+ <Radio.Group onChange={onTypeChange}>
|
|
|
+ <Radio value={1}>公告</Radio>
|
|
|
+ <Radio value={2}>其他</Radio>
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item name='title' label='标题' required>
|
|
|
+ <Input />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item name='content' label='内容' required>
|
|
|
+ <div className="ql-snow">
|
|
|
+ <div id='editor'></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item name='receiveType' label='接收者' required>
|
|
|
+ <Radio.Group onChange={onReceiveTypeChange}>
|
|
|
+ <Radio value={0}>所有人</Radio>
|
|
|
+ <Radio value={1}>自定义</Radio>
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ {showCustom?<div className="choose-container">
|
|
|
+ <SelectedTag></SelectedTag>
|
|
|
+ <div className="user-type-box">
|
|
|
+ <Tabs defaultActiveKey="1" onChange={handleTabChange}>
|
|
|
+ <TabPane tab="指定用户" key="1">
|
|
|
+ <UserList></UserList>
|
|
|
+ </TabPane>
|
|
|
+ <TabPane tab="指定科室" key="2">
|
|
|
+ <DeptTree></DeptTree>
|
|
|
+ </TabPane>
|
|
|
+ </Tabs>
|
|
|
+ </div>
|
|
|
+ </div>:""}
|
|
|
+ <div className="button-box">
|
|
|
+ <Button onClick={goBack}>取消</Button>
|
|
|
+ <Button onClick={sendMsg} type='primary'>发送</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </>)
|
|
|
+}
|
|
|
+
|
|
|
+export default AddNewMsg;
|