|
@@ -1,7 +1,7 @@
|
|
|
/*
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-09-14 10:46:45
|
|
|
- * @LastEditTime: 2022-03-09 14:35:48
|
|
|
+ * @LastEditTime: 2022-03-10 15:45:59
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/model.ts
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
getTaizhangImplementation,
|
|
|
commitTaizhangImplementation,
|
|
|
commitTaizhangDataDirectoryTableList,
|
|
|
-
|
|
|
+
|
|
|
} from './server';
|
|
|
-import { getTreeList,getMaterialListGrades} from '@/pages/GradeHospitalAccreditation/accreditationDetail/service';
|
|
|
+import { getTreeList, getMaterialListGrades } from '@/pages/GradeHospitalAccreditation/accreditationDetail/service';
|
|
|
import {
|
|
|
getScoreLevelData,
|
|
|
getAccreditationTypeData,
|
|
@@ -50,10 +50,10 @@ const articleManagement = () => {
|
|
|
const [departmentManagers, setDepartmentManagers] = useState<{ label: string; value: number }[]>(
|
|
|
[],
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
const [targetScores, setTargetScores] = useState<MccsClickableTabs.TabType[]>([]);
|
|
|
const [ruleTypes, setRuleTypes] = useState<MccsClickableTabs.TabType[]>([]);
|
|
|
-
|
|
|
+
|
|
|
const [selfEvaluationRecords, setSelfEvaluationRecords] = useState<MccsRecordList.MccsRecordListType>([]); // 自评记录
|
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState<number[] | string[]>([]);
|
|
|
|
|
@@ -63,10 +63,8 @@ const articleManagement = () => {
|
|
|
* ARTICLE_SET 条文设置
|
|
|
* BATCHSETTING 批量设置
|
|
|
*/
|
|
|
-
|
|
|
- const [drawerFormType, setDrawerFormType] = useState<'ARTICLE_SET' | 'BATCHSETTING'>(
|
|
|
- 'ARTICLE_SET',
|
|
|
- );
|
|
|
+
|
|
|
+ const [drawerFormType, setDrawerFormType] = useState<'ARTICLE_SET' | 'BATCHSETTING'|undefined>(undefined);
|
|
|
|
|
|
const [reloadRightContent, setReloadRightContent] = useState(false);
|
|
|
|
|
@@ -101,10 +99,12 @@ const articleManagement = () => {
|
|
|
const [accountTypeOptions, setAccountTypeOptions] = useState<{ label: string, value: string | number }[]>([]);
|
|
|
const [articleSettingFormInit, setArticleSettingFormInit] = useState<{}>({}); //条文设置表单回显默认值
|
|
|
|
|
|
- const [currentSelectedActObj,setCurrentSelectedActObj] = useState<any>(undefined); //当前正在操作的对象,例如当前选中的树中层级数据,点击详情的的行数据
|
|
|
+ const [currentSelectedActObj, setCurrentSelectedActObj] = useState<any>(undefined); //当前正在操作的对象,例如当前选中的树中层级数据,点击详情的的行数据
|
|
|
|
|
|
const [detailDrawerVisible, setdetailDrawerVisible] = useState(false); //条文详情抽屉
|
|
|
|
|
|
+ const [ifHasEdit,setifHasEdit] = useState(false); //是否操作了条文设置或者编辑操作
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -127,17 +127,17 @@ const articleManagement = () => {
|
|
|
const resp = await getTreeFileTableData(
|
|
|
specifyId
|
|
|
? {
|
|
|
- // 传入树结构id指定获取某一节点对应数据
|
|
|
- pageSize: 10,
|
|
|
- ...params,
|
|
|
- id: specifyId,
|
|
|
- }
|
|
|
+ // 传入树结构id指定获取某一节点对应数据
|
|
|
+ pageSize: 10,
|
|
|
+ ...params,
|
|
|
+ id: specifyId,
|
|
|
+ }
|
|
|
: {
|
|
|
- // 直接拿树结构id
|
|
|
- pageSize: 10,
|
|
|
- ...params,
|
|
|
- id: currentActivedTree ? currentActivedTree.id : 0,
|
|
|
- },
|
|
|
+ // 直接拿树结构id
|
|
|
+ pageSize: 10,
|
|
|
+ ...params,
|
|
|
+ id: currentActivedTree ? currentActivedTree.id : 0,
|
|
|
+ },
|
|
|
moduleMode,
|
|
|
);
|
|
|
|
|
@@ -173,7 +173,7 @@ const articleManagement = () => {
|
|
|
responsibilityUserName: '-',
|
|
|
accountType: '-',
|
|
|
hospId: -1,
|
|
|
- userId:-1
|
|
|
+ userId: -1
|
|
|
},
|
|
|
pfmViewRuleDetailDataVoList: [],
|
|
|
pfmImplementations: [],
|
|
@@ -193,15 +193,15 @@ const articleManagement = () => {
|
|
|
label: item.name,
|
|
|
value: item.id,
|
|
|
}));
|
|
|
- }
|
|
|
- return [];
|
|
|
-
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+
|
|
|
};
|
|
|
|
|
|
type FormValueType = {
|
|
|
articleType: { label: string; value: any };
|
|
|
- responsibilityDepartment: { label: string; value: number; [key: string]: any };
|
|
|
- responsibilityUser: { label: string; value: number; [key: string]: any };
|
|
|
+ responsibilityDepartment: { label: string; value: number;[key: string]: any };
|
|
|
+ responsibilityUser: { label: string; value: number;[key: string]: any };
|
|
|
targetScores: { label: string; value: any };
|
|
|
};
|
|
|
|
|
@@ -218,25 +218,26 @@ 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;
|
|
|
- if(detailDrawerVisible){
|
|
|
+ if (detailDrawerVisible) {
|
|
|
//在条文抽屉详情里条文设置
|
|
|
- ruleId = currentSelectedActObj.id;
|
|
|
- }else{
|
|
|
+ ruleId = currentSelectedActObj.id;
|
|
|
+
|
|
|
+ } else {
|
|
|
//正常在详情页设置条文
|
|
|
ruleId = Number(currentActivedTree.id)
|
|
|
}
|
|
@@ -253,26 +254,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);
|
|
@@ -416,7 +422,7 @@ const articleManagement = () => {
|
|
|
if (implementationData[level]) return; // implementationData集合里已经有了该等级对应的数据时,不请求,为了保证编辑的数据缓存
|
|
|
|
|
|
const data = await getTaizhangImplementation({ numStr, version, level });
|
|
|
-
|
|
|
+
|
|
|
const implementData: ImplementationDataItem[] = data.map((item) => ({
|
|
|
level: item.level,
|
|
|
note: item.note,
|
|
@@ -447,9 +453,8 @@ const articleManagement = () => {
|
|
|
const userData: { name: string; userId: number } = JSON.parse(_userData);
|
|
|
const params = {
|
|
|
id: Number(id),
|
|
|
- selfEvaluation: `${
|
|
|
- currentSelectedSelefEvolution ? currentSelectedSelefEvolution.value : 'null'
|
|
|
- }`,
|
|
|
+ selfEvaluation: `${currentSelectedSelefEvolution ? currentSelectedSelefEvolution.value : 'null'
|
|
|
+ }`,
|
|
|
userId: userData?.userId,
|
|
|
userName: userData?.name,
|
|
|
};
|
|
@@ -484,7 +489,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);
|
|
|
};
|
|
@@ -547,14 +551,14 @@ const articleManagement = () => {
|
|
|
const respDataDirectoryTable = await commitTaizhangDataDirectoryTableList(
|
|
|
taizhangDataDirectoryCommitList,
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
setEditMode(false);
|
|
|
// console.log({respDataDirectoryTable,respImplementation})
|
|
|
- if(respDataDirectoryTable&&respImplementation){
|
|
|
+ if (respDataDirectoryTable && respImplementation) {
|
|
|
// 每次服务保存数据成功后,清空台账上传的缓存数据
|
|
|
setImplementationData({}); // 清空执行情况说明
|
|
|
setTaizhangDataDirectoryCommitList([]); // 清空台账上传资料目录
|
|
|
-
|
|
|
+
|
|
|
getTableData(); // 两个保存都成功时刷新数据
|
|
|
}
|
|
|
}
|
|
@@ -563,23 +567,40 @@ const articleManagement = () => {
|
|
|
|
|
|
const getGradeOptions = async () => {
|
|
|
if (leafData) {
|
|
|
- const { numStr, version } = leafData.reviewArticle;
|
|
|
- const resp = await getMaterialListGrades({ numStr, version });
|
|
|
- if (resp) {
|
|
|
- const options = resp.map(item => ({ label: item.grade, value: item.grade }));
|
|
|
- setGradeOptions(options);
|
|
|
- }
|
|
|
+ const { numStr, version } = leafData.reviewArticle;
|
|
|
+ const resp = await getMaterialListGrades({ numStr, version });
|
|
|
+ if (resp) {
|
|
|
+ const options = resp.map(item => ({ label: item.grade, value: item.grade }));
|
|
|
+ setGradeOptions(options);
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
+ }
|
|
|
|
|
|
-const getAccoutTypeOptions = async () => {
|
|
|
+ const getAccoutTypeOptions = async () => {
|
|
|
const resp = await getLedgerType();
|
|
|
if (resp) {
|
|
|
- const options = resp.map(item => ({ label: item.generalName, value: item.generalName }));
|
|
|
- setAccountTypeOptions(options);
|
|
|
+ const options = resp.map(item => ({ label: item.generalName, value: item.generalName }));
|
|
|
+ setAccountTypeOptions(options);
|
|
|
}
|
|
|
-}
|
|
|
+ }
|
|
|
+
|
|
|
+ useEffect(()=>{
|
|
|
+ console.log({detailDrawerVisible});
|
|
|
+
|
|
|
+ if(!detailDrawerVisible&&ifHasEdit){
|
|
|
+ //详情抽屉关闭时刷新table
|
|
|
+ setReloadRightContent(true);
|
|
|
+ //更新完数据,重置状态
|
|
|
+ setifHasEdit(false);
|
|
|
+ }
|
|
|
|
|
|
+ },[detailDrawerVisible])
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (!drawerVisible) {
|
|
|
+ setDrawerFormType(undefined);
|
|
|
+ }
|
|
|
+ }, [drawerVisible]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
// 叶子结点数据变化后相关回调
|
|
@@ -610,7 +631,7 @@ const getAccoutTypeOptions = async () => {
|
|
|
setHasEditAuthority(userId == userData.userId);
|
|
|
|
|
|
setImplementationData({ [selfEvaluation]: leafData.pfmImplementations });
|
|
|
-
|
|
|
+
|
|
|
const selfEvolution = leafData.reviewArticle.selfEvaluation;
|
|
|
setSelectedSelfEvolution({ label: selfEvolution, value: selfEvolution });
|
|
|
setScoreList(tempScoreList);
|
|
@@ -620,13 +641,13 @@ const getAccoutTypeOptions = async () => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
// 当抽屉类型改变时
|
|
|
- if (drawerFormType == 'BATCHSETTING'||drawerFormType == 'ARTICLE_SET') {
|
|
|
+ if (drawerFormType == 'BATCHSETTING' || drawerFormType == 'ARTICLE_SET') {
|
|
|
getScoreList().then((data) => {
|
|
|
const dataFilted = data.filter((t: any) => t.configStatus != 0); // 去掉不启动
|
|
|
setTargetScores(dataFilted);
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+
|
|
|
accreditationGroupType().then((data) => {
|
|
|
setRuleTypes(data);
|
|
|
});
|
|
@@ -682,7 +703,7 @@ const getAccoutTypeOptions = async () => {
|
|
|
scoreList, // 评分
|
|
|
getDepartmentRequest,
|
|
|
departmentManagers,
|
|
|
- getDepartment,
|
|
|
+ getDepartmentUsers,
|
|
|
targetScores,
|
|
|
ruleTypes,
|
|
|
leafData,
|