Przeglądaj źródła

合并dev新功能

code4eat 3 lat temu
rodzic
commit
730a7a3c97

+ 105 - 94
src/pages/GradeHospitalAccreditation/articleManagement/components/articleDetailModule/drawer/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-03-07 11:05:19
- * @LastEditTime: 2022-03-14 09:58:29
+ * @LastEditTime: 2022-03-15 14:53:08
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/drawer/set.tsx
@@ -12,10 +12,11 @@
 import MccsDrawerForm from '@/components/MccsDrawerForm/index';
 import { ProFormDependency, ProFormInstance, ProFormSelect } from '@ant-design/pro-form';
 import MccsClickableTabs from '@/components/MccsClickableTabs/index';
-import { useRef } from 'react'
+import { useEffect, useRef, useState } from 'react'
 
 import { Form, Row, Col } from 'antd'
 import { useModel } from 'umi';
+import MultiResponsibilitySelecter from './multi';
 
 
 
@@ -33,27 +34,29 @@ const SetDrawer = () => {
         setCurrentActivedTree,
         scoreList,
         getDepartmentRequest,
-        departmentManagers,
-        getDepartmentUsers,
+
         ...restModelData
     } = articleManagement;
 
     const drawerFormRef = useRef<ProFormInstance>();
 
+    const [ifsetTargetScore, setifsetTargetScore] = useState(true); //设置目标分数是否必填
+    const [rows,setrows] = useState(0);
+    const [respDepartmentList,setrespDepartmentList] = useState<{label:string;value:any}[]|[]>([]);  //可选单位
 
 
     const onVisibleChangeHandle = (visible: boolean) => {
         //drawer展示控制
-        if(visible){
-            if(restModelData.leafData){
-                getDepartmentUsers(restModelData.leafData?.reviewArticle.responsibilityDepartmentId);
+        if (visible) {
+            if (restModelData.leafData) {
+                // getDepartmentUsers(restModelData.leafData?.reviewArticle.responsibilityDepartmentId);
             }
         }
-        !visible && articleManagement.setArticleSettingFormInit({});//清空默认值
+        !visible && restModelData.setArticleSettingFormInit(undefined);//清空默认值
         restModelData.setDrawerVisible(visible);
     }
-    
-    const setTitle = (type:string) => {
+
+    const setTitle = () => {
 
         if (restModelData.drawerFormType == 'ARTICLE_SET') {
             return '条文设置'
@@ -61,11 +64,14 @@ const SetDrawer = () => {
         if (restModelData.drawerFormType == 'BATCHSETTING') {
             return '批量设置'
         }
+        return ''
     }
 
-    const onFinishHandle = (values:any)=>{
-        
+    const onFinishHandle = (values: any) => {
+
         if (restModelData.drawerFormType == 'ARTICLE_SET') {
+            console.log({values});
+            return;
             restModelData.setArticle(values)
         }
         if (restModelData.drawerFormType == 'BATCHSETTING') {
@@ -73,96 +79,101 @@ const SetDrawer = () => {
         }
     }
 
+    const setRespDepartment =async () => {
+          const data = await getDepartmentRequest();
+          setrespDepartmentList(data);
+    }
+
+
+    useEffect(() => {
+        if (articleManagement.articleSettingFormInit && articleManagement.articleSettingFormInit.targetScores) {
+            setifsetTargetScore(true);
+        } else {
+            setifsetTargetScore(false);
+        }
+    }, [articleManagement.articleSettingFormInit?.targetScores]);
+
+    useEffect(()=>{
+        setRespDepartment();
+    },[])
+
+
+
     return (
         <MccsDrawerForm
-            title={setTitle(restModelData.drawerFormType?restModelData.drawerFormType:'')}
+            title={setTitle()}
             width={500}
             formRef={drawerFormRef}
             visible={restModelData.drawerVisible}
-            initialValues={restModelData.drawerFormType == 'ARTICLE_SET' ? { ...articleManagement.articleSettingFormInit } : {}}
+            initialValues={restModelData.drawerFormType == 'ARTICLE_SET' ? { 
+                ...articleManagement.articleSettingFormInit,
+                Co_DepartmentAndManager:[],
+                main_DepartmentAndManager:[{
+                    responsibilityDepartment:articleManagement.articleSettingFormInit?.responsibilityDepartment,
+                    responsibilityUser:articleManagement.articleSettingFormInit?.responsibilityUser
+                }]
+            } : undefined}
             onFinish={(values: any) => onFinishHandle(values)}
             onVisibleChange={onVisibleChangeHandle}
         >
-                    <div>
-                        <div className='formItemTitle'>负责人及单位</div>
-                        <Row gutter={16}>
-                            <Col className="gutter-row" span={10}>
-                                <ProFormSelect
-                                    name="responsibilityDepartment"
-                                    width='sm'
-                                    showSearch
-                                    request={getDepartmentRequest}
-                                    placeholder="选择单位"
-                                    fieldProps={{
-                                        labelInValue: true,
-                                        onChange: (item, option) => {
-                                            //责任单位修改时清空责任人
-                                
-                                            drawerFormRef.current?.setFieldsValue({ ...articleManagement.articleSettingFormInit, responsibilityUser: { label: '', value: '' } });
-                                            getDepartmentUsers(item.value, option)
-                                        }
-                                    }}
-                                    rules={[{ required: true, message: '请选择单位!' }]}
-                                />
-                            </Col>
-
-                            <Col className="gutter-row" span={8}>
-                                <ProFormDependency name={['responsibilityDepartment']}>
-                                    {({ responsibilityDepartment }) => {
-                                        return (
-                                            <ProFormSelect
-                                                name="responsibilityUser"
-                                                width='sm'
-                                                disabled={!responsibilityDepartment || JSON.stringify(responsibilityDepartment) == '{}'}
-                                                options={departmentManagers}
-                                                placeholder="选择负责人"
-                                                fieldProps={{
-                                                    labelInValue: true,
-                                                }}
-                                                rules={[{ required: true, message: '请选择负责人!' }]}
-                                            />
-                                        )
-                                    }}
-                                </ProFormDependency>
-                            </Col>
-                        </Row>
-                        <div className='formItemTitle'>目标分数</div>
-                        <Row >
-                            <Col span={24}>
-                                <Form.Item name='targetScores' rules={[
-                                    {
-                                        required: true,
-                                        message: '请选择目标分数!',
-                                    },
-                                ]}>
-                                    <MccsClickableTabs
-                                        data={restModelData.targetScores}
-                                    />
-                                </Form.Item>
-                            </Col>
-                        </Row>
-                        {
-                            true && (
-                                <>
-                                    <div className='formItemTitle'>条文组别</div>
-                                    <Row>
-                                        <Col span={24}>
-                                            <Form.Item name='articleType' rules={[
-                                                {
-                                                    required: true,
-                                                    message: '请选择条文组别!',
-                                                },
-                                            ]}>
-                                                <MccsClickableTabs
-                                                    data={restModelData.ruleTypes}
-                                                />
-                                            </Form.Item>
-                                        </Col>
-                                    </Row>
-                                </>
-                            )
-                        }
-                    </div>
+            <div>
+                <div className='formItemTitle require'>负责人及单位</div>
+                <Row >
+                    <Col span={24}>
+                           <Form.Item name='main_DepartmentAndManager'>
+                               <MultiResponsibilitySelecter options={respDepartmentList}  rows={1}  />
+                           </Form.Item>
+                    </Col>
+                </Row>
+                
+
+                <div className='formItemTitle'>合作负责人及单位<span onClick={() => setrows(rows+1)}>添加</span></div>
+                <Row >
+                    <Col span={24}>
+                           <Form.Item name='Co_DepartmentAndManager'>
+                               <MultiResponsibilitySelecter options={respDepartmentList} editable={true}  rows={rows}  />
+                           </Form.Item>
+                    </Col>
+                </Row>
+
+                <div className={ifsetTargetScore ? 'formItemTitle require' : 'formItemTitle'}>目标分数{ifsetTargetScore && <span onClick={() => setifsetTargetScore(false)}>暂不设置</span>}</div>
+                <Row >
+                    <Col span={24}>
+                        <Form.Item name='targetScores' rules={[
+                            {
+                                required: true,
+                                message: '请选择目标分数!',
+                            },
+                        ]}>
+                            <MccsClickableTabs
+                                clear={!ifsetTargetScore}
+                                data={restModelData.targetScores}
+                            />
+                        </Form.Item>
+                    </Col>
+                </Row>
+                {
+                    true && (
+                        <>
+                            <div className='formItemTitle require'>条文组别</div>
+                            <Row>
+                                <Col span={24}>
+                                    <Form.Item name='articleType' rules={[
+                                        {
+                                            required: true,
+                                            message: '请选择条文组别!',
+                                        },
+                                    ]}>
+                                        <MccsClickableTabs
+                                            data={restModelData.ruleTypes}
+                                        />
+                                    </Form.Item>
+                                </Col>
+                            </Row>
+                        </>
+                    )
+                }
+            </div>
         </MccsDrawerForm>
     )
 }

+ 186 - 0
src/pages/GradeHospitalAccreditation/articleManagement/components/articleDetailModule/drawer/multi.tsx

@@ -0,0 +1,186 @@
+/*
+ * @Author: your name
+ * @Date: 2022-03-14 11:17:12
+ * @LastEditTime: 2022-03-15 15:07:48
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/components/articleDetailModule/drawer/multi.tsx
+ */
+
+import { ProFormSelect } from "@ant-design/pro-form";
+import { Button, Col } from "antd";
+import { useEffect, useState } from "react";
+import { getDepartmentList } from "../../../server";
+
+
+export type DataItemType = {
+    id: number;
+    responsibilityDepartment: { label: string; value: number };
+    responsibilityUser: { label: string; value: number };
+    [key: string]: any
+}
+
+type PayloadType = {
+    key?: number;
+    label: string;
+    value: number;
+}
+
+export type MultiResponsibilitySelecterValueType = {
+    responsibilityDepartment: { label: string; value: number };
+    responsibilityUser: { label: string; value: number };
+
+}
+
+//多级责任人及单位设置
+const MultiResponsibilitySelecter = ({ 
+    rows = 0, options = [], value,onChange,editable=false
+}: { 
+    rows: number;
+    options: any[],
+    editable?:boolean;
+    value?: MultiResponsibilitySelecterValueType[],
+    onChange?: (val: DataItemType[]) => void 
+}) => {
+
+    const [data, setdata] = useState<DataItemType[] | []>([]);
+
+    const [selecterTwoList, setSelecterTwoList] = useState<{ label: string; value: number }[]>([]);
+
+    const setDepartmentUsers = async (editItemId: number, payload: any, currentEditItem?: DataItemType) => {
+        // 获取责任单位对应的责任人
+
+        const index = data.findIndex(t => t.id == editItemId);
+
+        if (!payload && currentEditItem) {
+            const resp = await getDepartmentList({ responsibilityDepartmentId: currentEditItem.responsibilityDepartment?.value });
+
+            if (resp) {
+                const { list = [] } = resp;
+                if (list.length > 0) {
+                    const tempPeople = list[0].sysEmployeeVOList.map((item) => ({
+                        label: item ? item.name : '-',
+                        value: item ? item.id : 0,
+                    }));
+                    setSelecterTwoList(tempPeople);
+
+                    currentEditItem['responsibilityUser'] = tempPeople[0];
+
+                    if (index >= 0) {
+                        const _data = data;
+                        _data.splice(index, 1, currentEditItem);
+                        setdata([..._data]);
+                    }
+
+                }
+            }
+        } else {
+            let a = data.filter((v: DataItemType) => v.id == editItemId);
+
+            if (a[0]) {
+                a[0]['responsibilityUser'] = payload;
+                const _data = data;
+                _data.splice(index, 1, a[0]);
+                setdata([..._data]);
+            }
+        }
+
+    };
+
+    const editDataItem = (id: number, payload: PayloadType) => {
+
+        let currentEditItem = data.filter((v: DataItemType) => v.id == id);
+
+        if (currentEditItem[0]) {
+
+            currentEditItem[0]['responsibilityDepartment'] = payload;
+            setDepartmentUsers(id, undefined, currentEditItem[0]);
+
+        }
+
+    }
+
+    const delhandle = (id:number)=>{
+        const index = data.findIndex(t => t.id == id);
+        const _data = data;
+        _data.splice(index, 1);
+        setdata([..._data]);
+    }
+
+
+    const SelectFormItem = ({ itemData }: { itemData: DataItemType }) => {
+
+        return (
+            <div style={{ display: 'flex', flexDirection: 'row' }}>
+                <Col className="gutter-row" span={12}>
+                    <ProFormSelect
+                        width='sm'
+                        showSearch
+                        placeholder="选择单位"
+                        options={options}
+                        fieldProps={{
+                            labelInValue: true,
+                            defaultValue: itemData.responsibilityDepartment,
+                            onChange: (item, option) => {
+                                editDataItem(itemData.id, item)
+                            }
+                        }}
+                        rules={[{ required: true, message: '请选择单位!' }]}
+                    />
+                </Col>
+                <Col className="gutter-row" span={editable?8:10}>
+                    <ProFormSelect
+                        width='sm'
+                        // disabled={true}
+                        options={selecterTwoList}
+                        placeholder="选择负责人"
+                        fieldProps={{
+                            labelInValue: true,
+                            value: itemData.responsibilityUser,
+                            onChange: (item, option) => {
+                                setDepartmentUsers(itemData.id, item)
+                            }
+                        }}
+                        rules={[{ required: true, message: '请选择负责人!' }]}
+                    />
+                </Col>
+                {editable&&<Col><Button onClick={()=>delhandle(itemData.id)} style={{fontSize:14}}>-</Button></Col>}
+            </div>
+        )
+    }
+
+
+    useEffect(() => {
+        if (rows > 0) {
+            setdata([...data, { id: Math.random(),responsibilityDepartment:{label:'-',value:-1},responsibilityUser:{label:'-',value:-1}}])
+        }
+    }, [rows]);
+
+    useEffect(()=>{
+        onChange&&onChange(data)
+    },[data])
+
+    useEffect(() => {
+
+        const _value = value?.map(v => ({ id: Math.random(), ...v }));
+
+        if (_value) {
+            setdata(_value);
+        }
+
+    }, []);
+
+    return (
+        <div style={{ display: 'flex', flexDirection: 'column' }}>
+            {
+                [...data].map((v, k) => {
+                    return (
+                        <SelectFormItem key={k} itemData={v} />
+                    )
+                })
+            }
+        </div>
+    )
+}
+
+export default MultiResponsibilitySelecter;

+ 23 - 3
src/pages/GradeHospitalAccreditation/articleManagement/components/articleDetailModule/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-03-08 10:41:15
- * @LastEditTime: 2022-03-10 11:44:00
+ * @LastEditTime: 2022-03-15 14:48:21
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/components/articleDetailModule/index.tsx
@@ -62,8 +62,6 @@ const ArticleDetail = ({ isModeTwo = false }) => {
         setCurrentActivedTree,
         scoreList,
         getDepartmentRequest,
-        departmentManagers,
-        getDepartmentUsers,//获取责任单位人
         currentSelectedActObj,
         ...restModelData
     } = articleManagement;
@@ -262,9 +260,31 @@ const ArticleDetail = ({ isModeTwo = false }) => {
     }
 
 
+    const setDrawerFormInit =  ()=>{
+        if (restModelData.leafData) {
+            const { responsibilityDepartmentId, responsibilityDepartmentName, responsibilityUserId, targetEvaluation, responsibilityUserName, accountType,pfmReviewArticleDepartList } = restModelData.leafData.reviewArticle;
+            if (responsibilityDepartmentName && responsibilityDepartmentId) {
+
+                restModelData.setArticleSettingFormInit({
+                    Co_DepartmentAndManager:pfmReviewArticleDepartList,
+                    responsibilityDepartment: { label: responsibilityDepartmentName, value: responsibilityDepartmentId },
+                    responsibilityUser: { label: responsibilityUserName, value: responsibilityUserId },
+                    targetScores: { label: targetEvaluation, value: targetEvaluation },
+                    articleType: { label: accountType, value: accountType },
+                });
+            }
+
+            restModelData.getGradeOptions();  //获取可选档次
+            restModelData.getAccoutTypeOptions(); //可选类型
+
+        }
+    }
+
+
     const articleSetBtnHandle = () => {
         //条文设置
         restModelData.setDrawerFormType('ARTICLE_SET');
+        setDrawerFormInit();
         restModelData.setDrawerVisible(true);
 
     }

+ 153 - 124
src/pages/GradeHospitalAccreditation/articleManagement/index.less

@@ -1,179 +1,208 @@
-
 .ArticleManagement {
-      //overwrite antd css
-.ant-col-6 {
-  margin-bottom: 10px;
-}
-
-.ant-space-align-center {
-  align-items: flex-start;
-}
-
-.ant-pro-table-search {
-  padding-bottom: 0;
-}
 
-.ant-pro-page-container-warp {
-  display: none !important;
-}
+  //overwrite antd css
+  .ant-col-6 {
+    margin-bottom: 10px;
+  }
 
-.ant-pro-card-col {
-  transition: width 0.2s ease-in;
-  transform: translate3d(0,0,0);
-}
+  .ant-space-align-center {
+    align-items: flex-start;
+  }
 
-textarea.ant-input {
-  font-size: 14px !important;
-  font-family: SourceHanSansCN-Normal, SourceHanSansCN;
-  font-weight: 400;
-  color: #525866 !important;
-}
+  .ant-pro-table-search {
+    padding-bottom: 0;
+  }
 
-//----------------
+  .ant-pro-page-container-warp {
+    display: none !important;
+  }
 
+  .ant-pro-card-col {
+    transition: width 0.2s ease-in;
+    transform: translate3d(0, 0, 0);
+  }
 
-.onlyMyselfFilter {
-  display: flex;
-  flex-direction: row;
-  justify-content: space-between;
-  align-items: center;
-  margin-bottom: 16px;
-  padding: 0 8px;
-  &>span {
-    font-size: 14px;
+  textarea.ant-input {
+    font-size: 14px !important;
     font-family: SourceHanSansCN-Normal, SourceHanSansCN;
     font-weight: 400;
-    color: #525966;
+    color: #525866 !important;
   }
-}
 
+  //----------------
 
-.selfEvaluationWrap {
-    padding: 16px;
-    background: #FFFFFF;
-    border-radius: 2px;
-    margin-bottom: 16px;
-    margin-top: 16px;
-  .selfEvaluation {
+
+  .onlyMyselfFilter {
     display: flex;
-    height: 28px;
     flex-direction: row;
+    justify-content: space-between;
     align-items: center;
+    margin-bottom: 16px;
+    padding: 0 8px;
 
-    span {
-      font-size: 20px;
-      font-family: SourceHanSansCN-Medium, SourceHanSansCN;
-      font-weight: 500;
-      padding-left: 16px;
-    }
-  }
-  .wrap {
-    .tab {
-      width: 20%;
-      height: 28px;
-      cursor: pointer;
-      text-align: center;
-      line-height: 28px;
-      background: #F7F8FA;
-      border-radius: 14px;
+    &>span {
       font-size: 14px;
       font-family: SourceHanSansCN-Normal, SourceHanSansCN;
       font-weight: 400;
-      color: #525866;
-      margin-right: 16px;
-
-      &.on {
-        color: #3377FF;
-        background: #EBF1FF;
-      }
-
-      &:last-child {
-        margin-right: 0;
-      }
+      color: #525966;
     }
   }
 
-}
-.cardWrap {
-  overflow-y: scroll;
 
-  .card {
+  .selfEvaluationWrap {
     padding: 16px;
     background: #FFFFFF;
     border-radius: 2px;
     margin-bottom: 16px;
+    margin-top: 16px;
 
-    .cardTitle {
-      font-size: 14px;
-      font-family: SourceHanSansCN-Normal, SourceHanSansCN;
-      font-weight: 400;
-      color: #292C33;
+    .selfEvaluation {
+      display: flex;
+      height: 28px;
+      flex-direction: row;
+      align-items: center;
+
+      span {
+        font-size: 20px;
+        font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+        font-weight: 500;
+        padding-left: 16px;
+      }
+    }
+
+    .wrap {
+      .tab {
+        width: 20%;
+        height: 28px;
+        cursor: pointer;
+        text-align: center;
+        line-height: 28px;
+        background: #F7F8FA;
+        border-radius: 14px;
+        font-size: 14px;
+        font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+        font-weight: 400;
+        color: #525866;
+        margin-right: 16px;
+
+        &.on {
+          color: #3377FF;
+          background: #EBF1FF;
+        }
+
+        &:last-child {
+          margin-right: 0;
+        }
+      }
+    }
+
+  }
+
+  .cardWrap {
+    overflow-y: scroll;
+
+    .card {
+      padding: 16px;
+      background: #FFFFFF;
+      border-radius: 2px;
       margin-bottom: 16px;
+
+      .cardTitle {
+        font-size: 14px;
+        font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+        font-weight: 400;
+        color: #292C33;
+        margin-bottom: 16px;
+      }
+
+      &:last-child {
+        margin-bottom: 0 !important;
+
+      }
+    }
+
+    &.isModeTwo {
+      padding-top: 16px;
+      background-color: #FFFFFF;
     }
 
-    &:last-child {
-      margin-bottom: 0 !important;
-    
+    .ant-form-item {
+      margin-bottom: 0;
     }
   }
 
-  &.isModeTwo {
-    padding-top: 16px;
+  .card {
+    padding: 16px;
     background-color: #FFFFFF;
   }
 
-  .ant-form-item {
-    margin-bottom: 0;
-  }
-}
 
-.card {
-  padding: 16px;
-  background-color: #FFFFFF;
-}
 
+  .selfEvolutionTitle {
+    text-align: left;
+    font-size: 16px;
+    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+    font-weight: 400;
+    color: #7A8599;
+    margin-top: 20px;
 
+  }
 
-.selfEvolutionTitle {
-  text-align: left;
-  font-size: 16px;
-  font-family: SourceHanSansCN-Normal, SourceHanSansCN;
-  font-weight: 400;
-  color: #7A8599;
-  margin-top: 20px;
+  .selfEvolutionArea {
+    text-align: center;
+    line-height: 50px;
+    background: #FFFFFF;
+    border-radius: 10px;
+    border: 1px dashed #DADEE6;
+    margin-top: 20px;
+    margin-bottom: 40px;
+    padding: 10px;
+    padding-top: 40px;
+  }
 
-}
+  .tabWrap {
+    justify-content: space-around;
+  }
 
-.selfEvolutionArea {
-  text-align: center;
-  line-height: 50px;
-  background: #FFFFFF;
-  border-radius: 10px;
-  border: 1px dashed #DADEE6;
-  margin-top: 20px;
-  margin-bottom: 40px;
-  padding: 10px;
-  padding-top: 40px;
-}
+  .formItemTitle {
+    font-size: 16px;
+    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+    font-weight: 400;
+    color: #7A8599;
+    margin-bottom: 16px;
+  }
 
-.tabWrap {
-  justify-content: space-around;
 }
 
 .formItemTitle {
+  position: relative;
   font-size: 16px;
   font-family: SourceHanSansCN-Normal, SourceHanSansCN;
   font-weight: 400;
   color: #7A8599;
   margin-bottom: 16px;
-}
 
-}
+  &>span {
+       position: absolute;
+       right:42px;
+       top:6px;
+       font-size: 12px;
+       color: #598cf0;
+       cursor: pointer;
+       &:hover {
+           color: #3377FF;
+       }
+  }
 
-.formItemTitle {
-  font-size: 16px;
-  font-family: SourceHanSansCN-Normal, SourceHanSansCN;
-  font-weight: 400;
-  color: #7A8599;
-  margin-bottom: 16px;
+  &.require {
+    &::before {
+      display: inline-block;
+      position: relative;
+      top: -2px;
+      content: '*';
+      margin-right: 4px;
+      color: rgb(255, 77, 79);
+      font-size: 14px;
+    }
+  }
 }

+ 3 - 25
src/pages/GradeHospitalAccreditation/articleManagement/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:09
- * @LastEditTime: 2022-03-10 16:06:11
+ * @LastEditTime: 2022-03-15 09:17:06
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/index.tsx
@@ -69,9 +69,6 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
         currentActivedTree,
         setCurrentActivedTree,
         scoreList,
-        getDepartmentRequest,
-        departmentManagers,
-        getDepartmentUsers,//获取责任单位人
         currentSelectedActObj,
         setdetailDrawerVisible,
         detailDrawerVisible,
@@ -251,7 +248,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
         //左侧树节点点击回调
         setCurrentActivedTree(data);
         restModelData.setCurrentSelectedActObj(data);
-        articleManagement.setArticleSettingFormInit({});//清空默认值
+        articleManagement.setArticleSettingFormInit(undefined);//清空默认值
         //重新获取数据
         tableRef?.current?.getTableRef().current?.reload();
     }
@@ -313,26 +310,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
     }, [restModelData]);
 
 
-    useEffect(() => {
-        //点击叶子结点时回调
-        if (restModelData.leafData) {
-            const { responsibilityDepartmentId, responsibilityDepartmentName, responsibilityUserId, targetEvaluation, responsibilityUserName, accountType } = restModelData.leafData.reviewArticle;
-            if (responsibilityDepartmentName && responsibilityDepartmentId) {
-
-                articleManagement.setArticleSettingFormInit({
-                    responsibilityDepartment: { label: responsibilityDepartmentName, value: responsibilityDepartmentId },
-                    responsibilityUser: { label: responsibilityUserName, value: responsibilityUserId },
-                    targetScores: { label: targetEvaluation, value: targetEvaluation },
-                    articleType: { label: accountType, value: accountType },
-                });
-            }
-
-            restModelData.getGradeOptions();  //获取可选档次
-            restModelData.getAccoutTypeOptions(); //可选类型
-
-        }
-
-    }, [restModelData.leafData]);
+  
 
 
     useEffect(() => {

+ 56 - 45
src/pages/GradeHospitalAccreditation/articleManagement/model.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:46:45
- * @LastEditTime: 2022-03-10 15:45:59
+ * @LastEditTime: 2022-03-15 15:16:59
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/model.ts
@@ -32,6 +32,7 @@ import {
 } from '@/pages/PlatformMana/generalSetting/serve';
 
 import { notification } from 'antd';
+import { DataItemType } from './components/articleDetailModule/drawer/multi';
 
 export interface ImplementationDataItem {
   level: string;
@@ -47,9 +48,7 @@ const articleManagement = () => {
   const [isLeaf, setIsLeaf] = useState(false);
   const [scoreList, setScoreList] = useState<{ label: string; value: string }[]>([]);
   const [leafData, setLeafData] = useState<API.LeafDataType>(); // 叶子结点数据
-  const [departmentManagers, setDepartmentManagers] = useState<{ label: string; value: number }[]>(
-    [],
-  );
+  
 
   const [targetScores, setTargetScores] = useState<MccsClickableTabs.TabType[]>([]);
   const [ruleTypes, setRuleTypes] = useState<MccsClickableTabs.TabType[]>([]);
@@ -97,7 +96,13 @@ const articleManagement = () => {
 
   const [gradeOptions, setGradeOptions] = useState<{ label: string, value: string | number }[]>([]);
   const [accountTypeOptions, setAccountTypeOptions] = useState<{ label: string, value: string | number }[]>([]);
-  const [articleSettingFormInit, setArticleSettingFormInit] = useState<{}>({});  //条文设置表单回显默认值
+  const [articleSettingFormInit, setArticleSettingFormInit] = useState<{
+    responsibilityDepartment:{label:string;value:any};
+    responsibilityUser:{label:string;value:any};
+    Co_DepartmentAndManager:{responsibilityDepartment:{label:string;value:any};responsibilityUser:{label:string;value:any};}[];
+    targetScores:{label:string;value:any};
+    articleType:{label:string;value:any};
+  }|undefined>(undefined);  //条文设置表单回显默认值
 
   const [currentSelectedActObj, setCurrentSelectedActObj] = useState<any>(undefined);  //当前正在操作的对象,例如当前选中的树中层级数据,点击详情的的行数据
 
@@ -173,7 +178,8 @@ const articleManagement = () => {
               responsibilityUserName: '-',
               accountType: '-',
               hospId: -1,
-              userId: -1
+              userId: -1,
+              pfmReviewArticleDepartList:[]
             },
             pfmViewRuleDetailDataVoList: [],
             pfmImplementations: [],
@@ -200,34 +206,47 @@ const articleManagement = () => {
 
   type FormValueType = {
     articleType: { label: string; value: any };
-    responsibilityDepartment: { label: string; value: number;[key: string]: any };
-    responsibilityUser: { label: string; value: number;[key: string]: any };
+
+    Co_DepartmentAndManager:DataItemType[];
+    main_DepartmentAndManager:DataItemType[];
+
     targetScores: { label: string; value: any };
   };
 
   const batchSetting = async (values: FormValueType) => {
     // 批量设置
-    const resp = await batchSettingArticle({
-      ruleIds: selectedRowKeys,
-      responsibilityDepartmentId: values.responsibilityDepartment.value,
-      responsibilityDepartmentName: values.responsibilityDepartment.label,
-      responsibilityUserId: values.responsibilityUser.value,
-      responsibilityUserName: values.responsibilityUser.label,
-      targetEvaluation: values.targetScores.value,
-      articleType: values.articleType.value,
-    });
-
-    if (resp) {
+    const {main_DepartmentAndManager,Co_DepartmentAndManager} = values;
+    
+    if(main_DepartmentAndManager[0]){
+      const resp = await batchSettingArticle({
+        ruleIds: selectedRowKeys,
+        responsibilityDepartmentId: main_DepartmentAndManager[0].responsibilityDepartment.value,
+        responsibilityDepartmentName: main_DepartmentAndManager[0].responsibilityDepartment.label,
+        responsibilityUserId: main_DepartmentAndManager[0].responsibilityUser.value,
+        responsibilityUserName:main_DepartmentAndManager[0].responsibilityUser.label,
+        targetEvaluation: values.targetScores.value,
+        articleType: values.articleType.value,
+        responsibilityList:Co_DepartmentAndManager.map(t=>({
+          responsibilityDepartmentId: t.responsibilityDepartment.value,
+          responsibilityDepartmentName: t.responsibilityDepartment.label,
+          responsibilityUserId: t.responsibilityUser.value,
+          responsibilityUserName:t.responsibilityUser.label,
+        }))
+      });
   
-      setReloadRightContent(true);
-
-      return true;
+      if (resp) {
+    
+        setReloadRightContent(true);
+  
+        return true;
+      }
     }
+    
   };
 
   const setArticle = async (values: FormValueType) => {
     // 条文设置
-
+    
     setifHasEdit(true);
 
     if (currentActivedTree && leafData) {
@@ -244,15 +263,23 @@ const articleManagement = () => {
 
       const { id } = leafData.reviewArticle;
 
+      const {main_DepartmentAndManager,Co_DepartmentAndManager} = values;
+
       const paramsData = {
         id,
         ruleId: ruleId,
-        responsibilityDepartmentId: values.responsibilityDepartment.value,
-        responsibilityDepartmentName: values.responsibilityDepartment.label,
-        responsibilityUserId: values.responsibilityUser.value,
-        responsibilityUserName: values.responsibilityUser.label,
+        responsibilityDepartmentId: main_DepartmentAndManager[0].responsibilityDepartment.value,
+        responsibilityDepartmentName: main_DepartmentAndManager[0].responsibilityDepartment.label,
+        responsibilityUserId: main_DepartmentAndManager[0].responsibilityUser.value,
+        responsibilityUserName:main_DepartmentAndManager[0].responsibilityUser.label,
         targetEvaluation: values.targetScores.value,
         articleType: values.articleType.value,
+        responsibilityList:Co_DepartmentAndManager.map(t=>({
+          responsibilityDepartmentId: t.responsibilityDepartment.value,
+          responsibilityDepartmentName: t.responsibilityDepartment.label,
+          responsibilityUserId: t.responsibilityUser.value,
+          responsibilityUserName:t.responsibilityUser.label,
+        }))
       };
 
       const resp = await settingArticle(paramsData);
@@ -271,20 +298,7 @@ const articleManagement = () => {
     }
   };
 
-  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 : '-',
-          value: item ? item.id : 0,
-        }));
-        setDepartmentManagers(tempPeople);
-      }
-    }
-  };
+  
 
   const getSelfEvaluationRecordList = async (id: number) => {
     const resp = await getSelfEvaluation(id);
@@ -585,8 +599,7 @@ const articleManagement = () => {
   }
 
   useEffect(()=>{
-       console.log({detailDrawerVisible});
-
+  
        if(!detailDrawerVisible&&ifHasEdit){
             //详情抽屉关闭时刷新table
             setReloadRightContent(true);
@@ -702,8 +715,6 @@ const articleManagement = () => {
     setCurrentActivedTree,
     scoreList, // 评分
     getDepartmentRequest,
-    departmentManagers,
-    getDepartmentUsers,
     targetScores,
     ruleTypes,
     leafData,

+ 14 - 1
src/pages/GradeHospitalAccreditation/articleManagement/typings.d.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:42
- * @LastEditTime: 2021-12-31 14:51:31
+ * @LastEditTime: 2022-03-15 15:11:19
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/typings.d.ts
@@ -82,6 +82,7 @@ declare namespace API {
     accountType: string; // 条文组别
     hospId: number;
     userId: number,
+    pfmReviewArticleDepartList:any[];  //合作单位及负责人
     // recordDay: number;
     // createTime: number;
     // updateTime: number;
@@ -103,6 +104,12 @@ declare namespace API {
     responsibilityUserName: string;
     targetEvaluation: string;
     articleType: string;
+    responsibilityList:{
+      responsibilityDepartmentId:number;
+      responsibilityDepartmentName:string;
+      responsibilityUserId:number;
+      responsibilityUserName:string;
+    }[];
   };
 
   type tableDataItemType = {
@@ -126,6 +133,12 @@ declare namespace API {
     responsibilityUserName: string;
     targetEvaluation: string;
     articleType: string;
+    responsibilityList:{
+      responsibilityDepartmentId:number;
+      responsibilityDepartmentName:string;
+      responsibilityUserId:number;
+      responsibilityUserName:string;
+    }[];
   };
 
   type GetSelfEvaluationRequestType = {