|
@@ -1,9 +1,8 @@
|
|
|
-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 { useState, useEffect} from 'react';
|
|
|
+import { Form, Input, Button, Table, Select, Pagination, Space, Modal, 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';
|
|
|
|
|
@@ -20,7 +19,8 @@ function HospitalSet() {
|
|
|
const [title, setTitle] = useState("");//数据总量
|
|
|
const [visible, setVisible] = useState(false);//弹窗
|
|
|
const [msvisible, setMsvisible] = useState(false);//删除的弹窗
|
|
|
- const [modalType, setModalType] = useState("");
|
|
|
+ const [unsaved, setUnsaved] = useState(false);//修改未保存弹窗
|
|
|
+ const [revise, setRevise] = useState(false);//是否修改 新增修改内容
|
|
|
const [HospsetidList, setHospsetidList] = useState([]);//代码类别模糊查找
|
|
|
const [type, setType] = useState("");
|
|
|
const [formData, setFormData] = useState(null);//当前行数据
|
|
@@ -142,15 +142,38 @@ function HospitalSet() {
|
|
|
setMsvisible(true)
|
|
|
}
|
|
|
|
|
|
- //提示框取消
|
|
|
+ //删除 提示框取消或关闭
|
|
|
function handleCancel() {
|
|
|
setMsvisible(false);
|
|
|
}
|
|
|
+ //新增修改 取消或关闭
|
|
|
function cancel() {
|
|
|
- setVisible(false)
|
|
|
- setFormData(null)
|
|
|
+ if(revise){
|
|
|
+ setUnsaved(true)
|
|
|
+ }else{
|
|
|
+ setVisible(false)
|
|
|
+ setFormData(null)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function isChange(a) {
|
|
|
+ setRevise(a)
|
|
|
+ }
|
|
|
+
|
|
|
+ function addCancel() {
|
|
|
+ setRevise(false)
|
|
|
+ setVisible(false)
|
|
|
+ setUnsaved(false)
|
|
|
+ setFormData(null)
|
|
|
}
|
|
|
+
|
|
|
+ function unsavedCancel() {
|
|
|
+ setUnsaved(false)
|
|
|
+ }
|
|
|
+
|
|
|
+ //新增修改 保存
|
|
|
function HospsetChange() {
|
|
|
+ setRevise(false)
|
|
|
setVisible(false)
|
|
|
getHospitalSet();
|
|
|
}
|
|
@@ -160,7 +183,6 @@ function HospitalSet() {
|
|
|
{ title: '参数值', dataIndex: 'val', key: 'index' },
|
|
|
{ title: '参数说明', dataIndex: 'code', key: 'index' },
|
|
|
{ title: '参数描述', dataIndex: 'remark', key: 'index'},
|
|
|
- { title: '状态', dataIndex: 'status', key: 'index'},
|
|
|
{
|
|
|
title: '操作', dataIndex: 'key', render: (text, record) => (
|
|
|
<Space size="middle">
|
|
@@ -260,9 +282,20 @@ function HospitalSet() {
|
|
|
forceRender={true}
|
|
|
>
|
|
|
<HospsetContext.Provider value={{type, formData}}>
|
|
|
- <AddHospset HospsetChange={HospsetChange} />
|
|
|
+ <AddHospset HospsetChange={HospsetChange} cancel={cancel} isChange={isChange}/>
|
|
|
</HospsetContext.Provider>
|
|
|
-
|
|
|
+ <Modal
|
|
|
+ title="提示"
|
|
|
+ okText='确定'
|
|
|
+ cancelText='取消'
|
|
|
+ // bodyStyle={{'zIndex':'1050'}}
|
|
|
+ width={400}
|
|
|
+ visible={unsaved}
|
|
|
+ onOk={addCancel}
|
|
|
+ onCancel={unsavedCancel}
|
|
|
+ >
|
|
|
+ <p>当前数据未保存 是否确认关闭?</p>
|
|
|
+ </Modal>
|
|
|
</Modal>
|
|
|
: ''}
|
|
|
<Modal
|
|
@@ -276,6 +309,8 @@ function HospitalSet() {
|
|
|
>
|
|
|
<p>确定要删除该参数?</p>
|
|
|
</Modal>
|
|
|
+
|
|
|
+
|
|
|
</div >
|
|
|
)
|
|
|
}
|