/*
 * @Author: your name
 * @Date: 2021-09-14 14:40:58
 * @LastEditTime: 2021-09-22 09:22:38
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /MedicalWisdomCheckSys/mock/articleManagement.ts
 */





// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';



function getList(req: Request, res: Response, u: string) {
  const dataSource = [
    {
      title: 'parent 0',
      id: '0-0',
      code:'1.1.1',
      isLeaf: false,
      levelNum:1,
      children: [
        { 
            title: 'leaf 0-0',
            id: '0-0-0',
            code:'1.1.1',
            isLeaf: false,
            levelNum:2,
            children:[
                { title: 'leaf 0-1-1-1', id: '0-0-1-1',code:'1.1.1', isLeaf: true,levelNum:3, },
            ]
        },
        { title: 'leaf 0-1', id: '0-0-1',code:'1.1.1', isLeaf: true,levelNum:2, },
      ],
    },
    {
      title: 'parent 1',
      id: '0-1',
      code:'1.1.1',
      isLeaf: false,
      levelNum:1,
      children: [
        {title: 'leaf 1-0', id: '0-1-0',code:'1.1.1', isLeaf: true,levelNum:2,},
        {title: 'leaf 1-1', id: '0-1-1',code:'1.1.1', isLeaf: true,levelNum:2, },
      ],
    },
    {
        title: 'parent 2',
        id: '0-2',
        code:'1.1.1',
        isLeaf: true,
        levelNum:1,
    },
  ];
  const result = {
    data:{
        list:dataSource,
        totalCount:dataSource.length,
        current:1
    },
    success: true,
    status:200,
  };
  setTimeout(()=>{
    return res.json(result); 
  },2000);
  
}

const getRuleDetailList = (req: Request, res: Response, u: string)=>{

  const result = {
    data:{
      ifLeaf:true,
      page:{
        pageSize:1,
        totalCount:2,
        totalPage:1,
        current:1,
        list:[
            {
              id:1,
              numStr:'1.1.1.1',
              name:'医院的功能、任务和定位明确，保持适度规模',
              responsibilityDepartmentName:'单位',
              responsibilityUserName:'张三',
              selfEvaluation:'A',
              targetEvaluation:'B',
              systemEvaluation:'C',
              siteEvaluation:'D'
            },
            {
                id:2,
                numStr:'1.1.1.2',
                name:'医院的功能、任务和定位明确，保持适度规模',
                responsibilityDepartmentName:'单位',
                responsibilityUserName:'张三',
                selfEvaluation:'A',
                targetEvaluation:'B',
                systemEvaluation:'C',
                siteEvaluation:'D'
              }
        ]
      },
      leafData:{
        id:2,
        numStr:'四码',
        name:'名称',
        responsibilityDepartmentName:'责任部门',
        responsibilityUserName:'责任人',
        selfEvaluation:'A',
        targetEvaluation:'B',
        systemEvaluation:'C',
        siteEvaluation:'D',
        records:[
            {
                evaluation:'E',
                details:[
                    {
                        userName:'用户名',
                        fileName:'文件名',
                        fileUrl:'文件链接',
                        createTime:'2021-09-14',
                        recordTypeName:'台帐类型'
                    }
                ]
            }
        ]
      }
    },
    success: true,
    status:200,
  };
  return res.json(result); 
}


const getDepartmentList = (req: Request, res: Response, u: string)=>{
    const result = {
        data:{
            totalCount:0,
            pageSize:1,
            current:1,
            list:[
                {
                    id:1,
                    name:'单位名称',
                    deptManagerId:'单位负责人的Id1',
                    deptManagerName:'单位负责人的名字',
                    delFlag:1,
                    hiId:0,
                    sort:1,
                },
                {
                    id:1,
                    name:'单位名称',
                    deptManagerId:'单位负责人的Id2',
                    deptManagerName:'单位负责人的名字',
                    delFlag:1,
                    hiId:0,
                    sort:1,
                }
            ]
        },
        success: true,
        status:200,
      };
      return res.json(result); 
}

const getSelfEvaluation = (req: Request, res: Response, u: string)=>{
  const result = {
    data:{
        totalCount:0,
        pageSize:1,
        current:1,
        list:[
            {
                id:1,
                selfEvaluation:'C',
                userName:'李四',
                createDate:'2021-09-22 09:19:20',    
            },
            {
              id:2,
              selfEvaluation:'A',
              userName:'李丽',
              createDate:'2021-09-22 09:19:20',    
            },
        ]
    },
    success: true,
    status:200,
  };
  return res.json(result); 
}



export default {
  'GET /api/pfm/reviewRules/getAllTree': getList,
  'GET /api/pfm/reviewArticle/list': getRuleDetailList,
  'GET /api/pfm/sysdepartment/getSysDepartmentList': getDepartmentList,
  'GET /api/pfm/pfmarticlehistory/getSelfEvaluation': getSelfEvaluation,
};
