|
@@ -1,11 +1,4 @@
|
|
|
-/*
|
|
|
- * @Author: your name
|
|
|
- * @Date: 2021-09-14 10:46:45
|
|
|
- * @LastEditTime: 2022-03-09 18:17:18
|
|
|
- * @LastEditors: Please set LastEditors
|
|
|
- * @Description: In User Settings Edit
|
|
|
- * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/model.ts
|
|
|
- */
|
|
|
+
|
|
|
|
|
|
import { useState, useEffect } from 'react';
|
|
|
import {
|
|
@@ -64,7 +57,7 @@ const articleManagement = () => {
|
|
|
* BATCHSETTING 批量设置
|
|
|
*/
|
|
|
|
|
|
- const [drawerFormType, setDrawerFormType] = useState<'ARTICLE_SET' | 'BATCHSETTING' | undefined>(undefined);
|
|
|
+ const [drawerFormType, setDrawerFormType] = useState<'ARTICLE_SET' | 'BATCHSETTING'|undefined>(undefined);
|
|
|
|
|
|
const [reloadRightContent, setReloadRightContent] = useState(false);
|
|
|
|
|
@@ -103,6 +96,8 @@ const articleManagement = () => {
|
|
|
|
|
|
const [detailDrawerVisible, setdetailDrawerVisible] = useState(false); //条文详情抽屉
|
|
|
|
|
|
+ const [ifHasEdit,setifHasEdit] = useState(false); //是否操作了条文设置或者编辑操作
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -216,18 +211,17 @@ const articleManagement = () => {
|
|
|
});
|
|
|
|
|
|
if (resp) {
|
|
|
- // 重新刷新表格
|
|
|
- if (!detailDrawerVisible) {
|
|
|
- //当条文详情抽屉存在时,暂不刷新table,交给抽屉关闭时判断刷新
|
|
|
- setReloadRightContent(true);
|
|
|
- }
|
|
|
+
|
|
|
+ setReloadRightContent(true);
|
|
|
return true;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const setArticle = async (values: FormValueType) => {
|
|
|
// 条文设置
|
|
|
- // console.log({values});
|
|
|
+
|
|
|
+ setifHasEdit(true);
|
|
|
+
|
|
|
if (currentActivedTree && leafData) {
|
|
|
|
|
|
let ruleId = 0;
|
|
@@ -251,26 +245,31 @@ const articleManagement = () => {
|
|
|
targetEvaluation: values.targetScores.value,
|
|
|
articleType: values.articleType.value,
|
|
|
};
|
|
|
+
|
|
|
const resp = await settingArticle(paramsData);
|
|
|
if (resp) {
|
|
|
// 更新界面信息
|
|
|
- if (!detailDrawerVisible) {
|
|
|
- //当条文详情抽屉存在时,暂不刷新table,交给抽屉关闭时判断刷新
|
|
|
+ if (detailDrawerVisible) {
|
|
|
+ //当条文详情抽屉存在时,暂不刷新table,交给抽屉关闭时判断刷新,只刷新详情数据
|
|
|
+ getTableData({id:currentSelectedActObj.id});
|
|
|
+
|
|
|
+ }else{
|
|
|
getTableData();
|
|
|
}
|
|
|
- return true;
|
|
|
+
|
|
|
+ setDrawerVisible(false);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const getDepartment = async (item: any, option: any) => {
|
|
|
- // 获取责任单位
|
|
|
- const resp = await getDepartmentList({ responsibilityDepartmentId: item.value });
|
|
|
+ const getDepartmentUsers = async (id:number, option?: any) => {
|
|
|
+ // 获取责任单位对应的责任人
|
|
|
+ const resp = await getDepartmentList({ responsibilityDepartmentId: id});
|
|
|
if (resp) {
|
|
|
const { list = [] } = resp;
|
|
|
if (list.length > 0) {
|
|
|
const tempPeople = list[0].sysEmployeeVOList.map((item) => ({
|
|
|
- label: item ? item.name : 'null',
|
|
|
+ label: item ? item.name : '-',
|
|
|
value: item ? item.id : 0,
|
|
|
}));
|
|
|
setDepartmentManagers(tempPeople);
|
|
@@ -481,7 +480,6 @@ const articleManagement = () => {
|
|
|
const accreditationGroupType = async () => {
|
|
|
// 获取条文组别
|
|
|
const data = await getAccreditationTypeData();
|
|
|
- console.log({ data });
|
|
|
const tempArr = data.map((t: any) => ({ label: t.categoryType, value: t.categoryType }));
|
|
|
return Promise.resolve(tempArr);
|
|
|
};
|
|
@@ -577,6 +575,17 @@ const articleManagement = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ useEffect(()=>{
|
|
|
+ console.log({detailDrawerVisible});
|
|
|
+
|
|
|
+ if(!detailDrawerVisible&&ifHasEdit){
|
|
|
+ //详情抽屉关闭时刷新table
|
|
|
+ setReloadRightContent(true);
|
|
|
+ //更新完数据,重置状态
|
|
|
+ setifHasEdit(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ },[detailDrawerVisible])
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (!drawerVisible) {
|
|
@@ -584,7 +593,6 @@ const articleManagement = () => {
|
|
|
}
|
|
|
}, [drawerVisible]);
|
|
|
|
|
|
-
|
|
|
useEffect(() => {
|
|
|
// 叶子结点数据变化后相关回调
|
|
|
if (leafData) {
|
|
@@ -626,7 +634,6 @@ const articleManagement = () => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
// 当抽屉类型改变时
|
|
|
- console.log('drawerFormType changed');
|
|
|
if (drawerFormType == 'BATCHSETTING' || drawerFormType == 'ARTICLE_SET') {
|
|
|
getScoreList().then((data) => {
|
|
|
const dataFilted = data.filter((t: any) => t.configStatus != 0); // 去掉不启动
|
|
@@ -689,7 +696,7 @@ const articleManagement = () => {
|
|
|
scoreList, // 评分
|
|
|
getDepartmentRequest,
|
|
|
departmentManagers,
|
|
|
- getDepartment,
|
|
|
+ getDepartmentUsers,
|
|
|
targetScores,
|
|
|
ruleTypes,
|
|
|
leafData,
|