浏览代码

参数管理

MFMF 3 年之前
父节点
当前提交
a93a3dd054

+ 7 - 0
src/api/request.js

@@ -68,6 +68,13 @@ const request = {
 	deleteDict: '/security-center/dictionaryManage/deleteDictionary',//删除字典
 	deleteDict: '/security-center/dictionaryManage/deleteDictionary',//删除字典
 	getCodeCategory: '/security-center/dictionaryManage/getCodeCategory',//查看字典管理代码类别
 	getCodeCategory: '/security-center/dictionaryManage/getCodeCategory',//查看字典管理代码类别
 	updateDict: '/security-center/dictionaryManage/updateDictionary',//修改字典
 	updateDict: '/security-center/dictionaryManage/updateDictionary',//修改字典
+	
+	//参数管理
+	getHospitalSet: '/security-center/hospitalSetManage/getHospitalSet',//查看参数管理
+	addHospitalSet: '/security-center/hospitalSetManage/addHospitalSet',//添加参数
+	deleteHospitalSet: '/security-center/hospitalSetManage/deleteHospitalSet',//删除参数
+	getHospitalNames: '/security-center/hospitalSetManage/getHospitalNames',//查看参数管理代码类别
+	updateHospitalSet: '/security-center/hospitalSetManage/updateHospitalSet',//修改参数
 
 
     //日志管理
     //日志管理
     getOperationLog: '/security-center/logManage/getOperationLog',//操作日志
     getOperationLog: '/security-center/logManage/getOperationLog',//操作日志

+ 2 - 0
src/components/AMenu/index.js

@@ -7,6 +7,7 @@ import RoleManager from "../RoleManager";
 import UserManager from "../UserManager";
 import UserManager from "../UserManager";
 import DataManager from "../DataManager";
 import DataManager from "../DataManager";
 import DictManager from "../DictManager";
 import DictManager from "../DictManager";
+import HospitalSet from "../HospitalSet";
 import InpaManager from "../InpaManager";
 import InpaManager from "../InpaManager";
 import NullPage from "../NullPage";
 import NullPage from "../NullPage";
 import FuncManager from "../FuncManager";
 import FuncManager from "../FuncManager";
@@ -30,6 +31,7 @@ const pageMap = {
     'QXGL-BQQX': <InpaManager />,
     'QXGL-BQQX': <InpaManager />,
     'XTSZ-GNGL': <FuncManager />,
     'XTSZ-GNGL': <FuncManager />,
 	'XTSZ-ZDGL': <DictManager />,
 	'XTSZ-ZDGL': <DictManager />,
+	'XTSZ-SCGL': <HospitalSet />,
     'RZGL-CZRZ': <OperationLog />,
     'RZGL-CZRZ': <OperationLog />,
     'RZGL-DLRZ': <LoginLog />,
     'RZGL-DLRZ': <LoginLog />,
     'RZGL-YCRZ': <ExceptionLog />,
     'RZGL-YCRZ': <ExceptionLog />,

+ 3 - 5
src/components/DictManager/addDict.js

@@ -4,7 +4,7 @@ import React, {
 import { Modal, Form, Input, Select, Button, Switch, TreeSelect, message, Space } from 'antd';
 import { Modal, Form, Input, Select, Button, Switch, TreeSelect, message, Space } from 'antd';
 import apiObj from '@api/index';
 import apiObj from '@api/index';
 import utils from '@utils/index'
 import utils from '@utils/index'
-import UserContext from './Dict-context';
+import DictContext from './Dict-context';
 import { useSelector } from 'react-redux'
 import { useSelector } from 'react-redux'
 import Item from 'antd/lib/list/Item';
 import Item from 'antd/lib/list/Item';
 const { post, api, xPost } = apiObj;
 const { post, api, xPost } = apiObj;
@@ -14,7 +14,7 @@ const { SHOW_PARENT } = TreeSelect;
 function AddDict(props) {
 function AddDict(props) {
   
   
   const [form] = Form.useForm();
   const [form] = Form.useForm();
-  const { type, formData} = useContext(UserContext);
+  const { type, formData} = useContext(DictContext);
   const staticInfo = useSelector(state => {
   const staticInfo = useSelector(state => {
     return state.staticInfo;
     return state.staticInfo;
   });
   });
@@ -24,7 +24,6 @@ function AddDict(props) {
   const onFinish = values => {
   const onFinish = values => {
 	  values.groupType =Number(values.groupType)
 	  values.groupType =Number(values.groupType)
 	  values.status ? values.status=1:values.status=0
 	  values.status ? values.status=1:values.status=0
-	  console.log(values)
     let params = values
     let params = values
     if (type == 3) {
     if (type == 3) {
 	  params.id=initialValues.id
 	  params.id=initialValues.id
@@ -93,7 +92,6 @@ function AddDict(props) {
         >
         >
           {type == 3 ?
           {type == 3 ?
 		    <Input  autoComplete='off'/>
 		    <Input  autoComplete='off'/>
-            // <span>{initialValues.groupType}</span>
             :
             :
             <Input placeholder="请输入代码类别" autoComplete='off'/>
             <Input placeholder="请输入代码类别" autoComplete='off'/>
           }
           }
@@ -151,7 +149,7 @@ function AddDict(props) {
         </Form.Item>
         </Form.Item>
         <Form.Item
         <Form.Item
           name="status"
           name="status"
-          valuePropName="checked"
+		  valuePropName="checked"
           label="当前状态"
           label="当前状态"
           rules={[{ required: true, message: '请选择状态' }]}
           rules={[{ required: true, message: '请选择状态' }]}
         >
         >

+ 2 - 3
src/components/DictManager/index.js

@@ -60,7 +60,6 @@ function DictManager() {
     post(api.getDictTree, param || params).then((res) => {
     post(api.getDictTree, param || params).then((res) => {
       if (res.data.code === 200) {
       if (res.data.code === 200) {
         const data = res.data.data;
         const data = res.data.data;
-		console.log(data.records)
         setDictList(data.records);
         setDictList(data.records);
         setTotal(data.total)
         setTotal(data.total)
       }
       }
@@ -154,7 +153,7 @@ function DictManager() {
     { title: '字典编码', dataIndex: 'val', key: 'index' },
     { title: '字典编码', dataIndex: 'val', key: 'index' },
     { title: '代码名称', dataIndex: 'name', key: 'index' },
     { title: '代码名称', dataIndex: 'name', key: 'index' },
     { title: '字典说明', dataIndex: 'remark', key: 'index' },
     { title: '字典说明', dataIndex: 'remark', key: 'index' },
-    { title: '状态', dataIndex: 'status', key: 'status'},
+    { title: '状态', dataIndex: 'status', key: 'index'},
     {
     {
       title: '操作', dataIndex: 'key', render: (text, record) => (
       title: '操作', dataIndex: 'key', render: (text, record) => (
         <Space size="middle">
         <Space size="middle">
@@ -199,7 +198,7 @@ function DictManager() {
               </Form.Item>
               </Form.Item>
             </Col>
             </Col>
             
             
-            <Col span={6} key={3}>
+            <Col span={6} key={2}>
               <Form.Item>
               <Form.Item>
                 <Button type="primary" htmlType="submit">
                 <Button type="primary" htmlType="submit">
                   查询
                   查询

+ 4 - 0
src/components/HospitalSet/Hospset-context.js

@@ -0,0 +1,4 @@
+import { createContext } from 'react';
+const HospsetContext = createContext(null);
+
+export default HospsetContext;

+ 182 - 0
src/components/HospitalSet/addHospset.js

@@ -0,0 +1,182 @@
+import React, {
+  useState, useEffect, useContext
+} from 'react';
+import { Modal, Form, Input, Select, Button, Switch, TreeSelect, message, Space } from 'antd';
+import apiObj from '@api/index';
+import utils from '@utils/index'
+import UserContext from './Hospset-context';
+import { useSelector } from 'react-redux'
+import Item from 'antd/lib/list/Item';
+const { post, api, xPost } = apiObj;
+const { Option, OptGroup } = Select;
+const { organizationData } = utils;
+const { SHOW_PARENT } = TreeSelect;
+
+function AddHospset(props) {
+  const [HospsetidList, setHospsetidList] = useState([]);//代码类别模糊查找
+  const [form] = Form.useForm();
+  const { type, formData} = useContext(UserContext);
+  const staticInfo = useSelector(state => {
+    return state.staticInfo;
+  });
+  const { titleList } = staticInfo;
+  const initialValues = formData;
+
+  const onFinish = values => {
+    let params = values
+    if (type == 3) {
+      updateHospitalSet(params)
+    } else {
+      addHospitalSet(params)
+    }
+
+  };
+  function addHospitalSet(param) {
+    post(api.addHospitalSet, param).then((res) => {
+      if (res.data.code === 200) {
+        props.HospsetChange()
+        message.success(res.data.message);
+        form.resetFields();
+      } else {
+        message.error(res.data.message);
+      }
+    })
+  }
+  function updateHospitalSet(param) {
+    post(api.updateHospitalSet, param).then((res) => {
+      if (res.data.code === 200) {
+        props.HospsetChange()
+        message.success(res.data.message);
+        form.resetFields();
+      } else {
+        message.error(res.data.message);
+      }
+    })
+  }
+  //模糊查询
+  function getHospitalNames(val){
+  	  xPost(api.getHospitalNames,{hospitalName:val}).then((res) => {
+  	    if (res.data.code === 200) {
+  	      const data = res.data.data;
+  	      setHospsetidList(data)
+  	    }
+  	  })
+  }
+   function onSearch(value) {
+  	  getHospitalNames(value)
+   }
+   function onFocus() {
+   	  getHospitalNames("")
+   }
+  function cancel() {
+    props.HospsetChange()
+  }
+
+  return (
+    <>
+      <Form
+        labelCol={{ span: 6 }}
+        wrapperCol={{ span: 16 }}
+        form={form}
+        name="register"
+        onFinish={onFinish}
+        initialValues={initialValues}
+      >
+
+        <Form.Item
+          name="hospitalName"
+          label="所属组织"
+          rules={[
+            
+          ]}
+        >
+          <Select
+            showSearch
+            optionFilterProp="children"
+          	onSearch={onSearch}
+          	onFocus={onFocus}
+          >
+          {HospsetidList.map((item) => {
+            return (
+              <Option value={item} key={item}>{item}</Option>
+            )
+          })}
+          </Select>
+
+        </Form.Item>
+        <Form.Item
+          name="code"
+          label="参数名"
+          rules={[
+            {
+              required: true,
+              message: '请输入参数名',
+            },
+          ]}
+        >
+          {type == 3 ?
+            <Input  autoComplete='off'/>
+            :
+            <Input placeholder="请输入参数名" autoComplete='off'/>
+          }
+
+        </Form.Item>
+        <Form.Item
+          name="val"
+          label="参数值"
+          rules={[{ required: true, message: '请输入参数值', whitespace: true }]}
+        >
+          {type == 3 ?
+            <Input  autoComplete='off'/>
+            :
+            <Input placeholder="请输入参数值" autoComplete='off'/>
+          }
+
+        </Form.Item>
+        <Form.Item
+          name="name"
+          label="参数说明"
+		  rules={[
+		    {
+		      required: true,
+		      message: '请输入参数说明',
+		    }, 
+			{
+		      max: 50,
+		      message: '密码不能大于50个字符',
+		    },
+			]}
+        >
+          {type == 3 ?
+            <Input autoComplete='off'/>
+            :
+            <Input placeholder="50个字以内" autoComplete='off'/>
+          }
+
+        </Form.Item>
+        <Form.Item
+          name="remark"
+          label="参数描述"
+          rules={[{ required: true, message: '请输入参数描述' }]}
+        >
+		      <Input autoComplete='off'/>
+			  
+        </Form.Item>
+        
+          <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
+            <Space size="middle">
+              <Button htmlType="button" onClick={e => cancel()}>
+                取消
+            </Button>
+              <Button type="primary" htmlType="submit">
+                保存
+            </Button>
+            </Space>
+          </Form.Item>
+
+      </Form>
+    </>
+  );
+}
+
+export default AddHospset;

+ 273 - 0
src/components/HospitalSet/index.js

@@ -0,0 +1,273 @@
+import React, { useState, useEffect, useRef } from 'react';
+import { Form, Input, Button, Table, Select, Pagination, Space, Menu, Dropdown, Modal, Breadcrumb, message, Row, Col } from 'antd';
+import { DownOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
+import AddHospset from './addHospset'
+import '@common/common.less';
+import { useSelector } from 'react-redux'
+import apiObj from '@api/index';
+import HospsetContext from './Hospset-context';
+
+const { post, api, xPost } = apiObj;
+const { Option } = Select;
+//获取列表
+function HospitalSet() {
+  useEffect(() => {
+	getHospitalNames("")
+	getHospitalSet();
+  }, []);
+  const [HospsetList, setHospsetList] = useState([]);//当前页列表数据
+  const [Hospsetid, setHospsetid] = useState([]);//当前列表id
+  const [title, setTitle] = useState("");//数据总量
+  const [visible, setVisible] = useState(false);//弹窗
+  const [msvisible, setMsvisible] = useState(false);//删除的弹窗
+  const [modalType, setModalType] = useState("");
+  const [HospsetidList, setHospsetidList] = useState([]);//代码类别模糊查找
+  const [type, setType] = useState("");
+  const [formData, setFormData] = useState(null);//当前行数据
+  const [size, setSize] = useState(15);//每页显示条数
+  const [total, setTotal] = useState(0);
+  const [current, setCurrent] = useState(1);//当前页
+  const [params, setParams] = useState({
+    pages: 1,
+	current: 1,
+    size: 15
+  });
+  const [form] = Form.useForm();
+
+
+  let list = []
+  let data = {
+    pages: 1,
+    current: 1,
+    size: size
+  }
+  //新增弹窗
+  const showModal = (name, type, flag, Hospsetrow) => {
+    setVisible(type);
+    setTitle(name);
+    setType(flag)
+    if (flag == 1) {
+      setFormData({
+        status: '1'
+      })
+    }
+    if (flag == 3) {
+		setFormData(Hospsetrow)
+		getHospitalSet()
+		}
+  }
+  //表格数据
+  function getHospitalSet(param) {
+    post(api.getHospitalSet, param || params).then((res) => {
+      if (res.data.code === 200) {
+        const data = res.data.data;
+        setHospsetList(data.records);
+        setTotal(data.total)
+      }
+    })
+  }
+  
+  //模糊查询
+  function getHospitalNames(val){
+  	  xPost(api.getHospitalNames,{hospitalName:val}).then((res) => {
+  	    if (res.data.code === 200) {
+  	      const data = res.data.data;
+  	      setHospsetidList(data)
+  	    }
+  	  })
+  }
+   function onSearch(value) {
+	  getHospitalNames(value)
+   }
+
+   
+  
+  
+  //删除
+  function deleteHospitalSet() {
+    xPost(api.deleteHospitalSet,{id:Hospsetid}).then((res) => {
+      if (res.data.code === 200) {
+        getHospitalSet();
+        setMsvisible(false);
+		setHospsetid(null)
+        message.success("删除成功");
+      } else {
+        message.warning(res.data.msg || '操作失败');
+      }
+    }).catch(() => {
+      message.error("接口出错");
+    });
+  }
+  //每页显示条数切换
+  function onSizeChange(current, pageSize) {
+    params.current = current
+    params.size = pageSize
+    setSize(pageSize)
+    setCurrent(current)
+    setParams(params)
+    getHospitalSet()
+  }
+  //翻页
+  function changePage(page, pageSize) {
+    params.current = page
+    params.size = pageSize
+    setCurrent(page)
+    setParams(params)
+    getHospitalSet()
+  }
+  const onFinish = (value) => {
+    const param = {
+      ...data,
+      ...value
+    }
+    setCurrent(1)
+    setParams(param)
+    getHospitalSet(param);
+  };
+  const onReset = () => {
+    setCurrent(1)
+    setParams(data)
+    form.resetFields();
+    getHospitalSet(data);
+  };
+  const messageBox = (id) => {
+	setHospsetid(id)
+    setMsvisible(true)
+  }
+
+  //提示框取消
+  function handleCancel() {
+    setMsvisible(false);
+  }
+  function cancel() {
+    setVisible(false)
+    setFormData(null)
+  }
+  function HospsetChange() {
+    setVisible(false)
+	getHospitalSet();
+  }
+  const columns = [
+    { title: '所属组织', dataIndex: 'hospitalName', key: 'index' },
+    { title: '参数名', dataIndex: 'code', key: 'index' },
+    { title: '参数值', dataIndex: 'val', key: 'index' },
+    { title: '参数说明', dataIndex: 'name', key: 'index' },
+    { title: '参数描述', dataIndex: 'remark', key: 'status'},
+    {
+      title: '操作', dataIndex: 'key', render: (text, record) => (
+        <Space size="middle">
+          
+          <a onClick={e => showModal('修改参数', true, 3, record)}>修改</a>
+		  <a onClick={e => messageBox(record.id)}>删除</a>
+         
+
+        </Space>
+      )
+    }
+  ]
+  return (
+    <div className="wrapper">
+      <div className="filter-box">
+        <Form
+          form={form}
+          name="normal_login"
+          onFinish={onFinish}
+          initialValues={{ status: '' }}
+        >
+          <Row gutter={24}>
+            <Col span={5} key={0}>
+              <Form.Item label="所属组织" name="hospitalName">
+                <Select
+                  showSearch
+                      optionFilterProp="children"
+					  onSearch={onSearch}
+                >
+                {HospsetidList.map((item) => {
+                  return (
+                    <Option value={item} key={item}>{item}</Option>
+                  )
+                })}
+                </Select>
+              </Form.Item>
+            </Col>
+            <Col span={5} key={1}>
+              <Form.Item label="参数名" name="code">
+                <Input placeholder="参数名" autoComplete='off'/>
+              </Form.Item>
+            </Col>
+			<Col span={5} key={2}>
+			  <Form.Item label="参数说明" name="name">
+			    <Input placeholder="参数说明" autoComplete='off'/>
+			  </Form.Item>
+			</Col>
+            
+            <Col span={6} key={3}>
+              <Form.Item>
+                <Button type="primary" htmlType="submit">
+                  查询
+                </Button>
+                <Button onClick={onReset}>
+                  重置
+                </Button>
+              </Form.Item>
+            </Col>
+          </Row>
+        </Form>
+      </div>
+
+      <div className="table">
+        <div className="table-header">
+          <h2 className="table-title">参数管理</h2>
+          <Button type="primary" icon={<PlusOutlined />} onClick={e => showModal('新增参数', true, 1)}>新增参数</Button>
+        </div>
+
+        <Table
+          columns={columns}
+          scroll={{ y: 'calc(100vh - 320px)' }}
+          dataSource={HospsetList}
+          rowKey={record => record.id}
+          pagination={{
+            current: current,
+            pageSize: size,
+            size: 'small',
+            showSizeChanger: true,
+            pageSizeOptions: ['15', '30', '60', '120'],
+            showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
+            onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
+            onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
+            total: total
+          }} />
+      </div>
+      {visible && formData ?
+        <Modal
+          title={title}
+          okText='确定'
+          cancelText='取消'
+          width={'45%'}
+          visible={visible}
+          onCancel={cancel}
+          footer={null}
+          forceRender={true}
+        >
+          <HospsetContext.Provider value={{type, formData}}>
+            <AddHospset HospsetChange={HospsetChange} />
+          </HospsetContext.Provider>
+
+        </Modal>
+        : ''}
+      <Modal
+        title="提示"
+        okText='确定'
+        cancelText='取消'
+        width={400}
+        visible={msvisible}
+        onOk={deleteHospitalSet}
+        onCancel={handleCancel}
+      >
+        <p>确定要删除该参数?</p>
+      </Modal>
+    </div >
+  )
+}
+
+export default HospitalSet;