<!--
  -    Copyright (c) 2018-2025, lengleng All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without
  - modification, are permitted provided that the following conditions are met:
  -
  - Redistributions of source code must retain the above copyright notice,
  - this list of conditions and the following disclaimer.
  - Redistributions in binary form must reproduce the above copyright
  - notice, this list of conditions and the following disclaimer in the
  - documentation and/or other materials provided with the distribution.
  - Neither the name of the pig4cloud.com developer nor the names of its
  - contributors may be used to endorse or promote products derived from
  - this software without specific prior written permission.
  - Author: lengleng (493840844@qq.com)
  -->
<script>

    const HEATH='heath'
    const TEACHER_CATE='professional_teacher_cate'
    const EXAM_STATUS="EXAM_STATUS"

    //技能提升
    const PROJECT_UP ='457a3c52eb9642649321f2d40b2783bc'
    //第三方认证
    const PROJECT_OTHER ='cf8766a8b05f02335f5f95803bd976d8'



    //非税测试地址

    // const TAX_BASE_URL = 'http://titan.finstone.com.cn/nontax/login2'
    //用户同步接口
    // const TAX_USER_SYNC_URL = 'http://titan.finstone.com.cn/fs-gateway/autosyn/h5Data'

    //const TAX_BASE_URL = 'http://titan.finstone.com.cn/nontax/login2/'
    const TAX_BASE_URL = 'http://58.216.242.31:8098/nontax/login2/'

    const TAX_USER_SYNC_URL = 'http://58.216.242.31:8098/fs-gateway/autosyn/h5Data'

    //地区码
    const ADM_DIV_CODE = '320400'
    //单位代码
    const AGENCY_CODE = '039003'
    //测试token
    const TEST_TOKEN = 'cztoken'
    //主题管理
    const METHOD_THEME = 'sfztgl'
    //业务办理
    const METHOD_BUSINESS = 'ywbl'
    //业务查询
    const METHOD_BUSINESS_SEARCH = 'jfcl'
    //缴费处理
    const METHOD_PAY = 'djtzdjfKjsq'


    const KNOWLEDGE_EXAM = "knowledge_exam"

  //生成tax请求地址
  function combineTaxUrl(arr) {
      return TAX_BASE_URL+arr.join('/')
  }

  function getTaxUrl(token,taxMethod) {
    let arr = [ADM_DIV_CODE,
               token,
               taxMethod,
               AGENCY_CODE
    ]
    return TAX_BASE_URL+'/'+arr.join('/')
  }

  //人事审核通过  通用
  function changeState(row,val,method,_this){
    let data={}
    data.id=row.id
    data.state=val;
    let str="";
    if(val === 1){
      str="通过"
    }
    if(val === -2){
      str="驳回"
    }
    _this.$confirm('是否确认'+str +row.realName+"的申请" , '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(function() {
      return method(data)
    }).then(data => {
      _this.$message({
        showClose: true,
        message: '操作成功',
        type: 'success'
      })
      _this.getList(_this.page)
    }).catch(function(err) { })
  }

  const YES_OR_NO=[
    {
      label:'是',
      value:'1'
    },
    {
      label:'否',
      value:'0'
    },
  ]

  const YES_OR_NO_INT=[
      {
          label:'是',
          value: 1
      },
      {
          label:'否',
          value: 0
      },
  ]

  const LOCK_STATUS=[
    {
      label:'锁定',
      value:'1'
    },
    {
      label:'未锁定',
      value:'0'
    },
  ]

    const RECORD_STATUS=[
      {
        label:'已录',
        value:'1'
      },
      {
        label:'未录',
        value:'0'
      },
    ]

  const COURSE_SIGN_STATUS=[
    {
      label:'未开启',
      value:'0'
    },
    {
      label:'开启',
      value:'1'
    },
  ]

  const COURSE_OPEND_STATUS=[
    {
      label:'未开课',
      value:'0'
    },
    {
      label:'已开课',
      value:'1'
    },
  ]

    const SCORE_LEVEL_INT=[
      {
        label:'优秀',
        value:1
      },
      {
        label:'良好',
        value:2
      },
      {
        label:'合格',
        value:3
      },
      {
        label:'不合格',
        value:4
      },
      {
        label:'中等',
        value:5
      }
    ]

  const  POINT_SYSTEM=[
    {
      label:'百分制',
      value:'1'
    },
    {
      label:'等級制',
      value:'2'
    }
  ]
    const invalidState=[
      {
        label:'正常',
        value:'0'
      },
      {
        label:'报废中',
        value:'1'
      }
    ]
    const transferState=[
      {
        label:'正常',
        value:'0'
      },
      {
        label:'调拨中',
        value:'1'
      }
    ]
    const all_room_type_id=[
      {
        label:'实训室',
        value:'0'
      },
      {
        label:'办公室',
        value:'1'
      },
      {
        label:'教室',
        value:'2'
      },
      {
        label:'宿舍',
        value:'3'
      },{
        label:'会议室',
        value:'4'
      },
      {
        label:'仓库',
        value:'5'
      },
      {
        label:'阶梯教室',
        value:'7'
      },
      {
        label:'弱电间',
        value:'8'
      },
      {
        label:'其他',
        value:'6'
      }
    ]
    const all_room_type=[
      {
        label:'实训室',
        value:'0'
      },
      {
        label:'办公室',
        value:'1'
      },
      {
        label:'教室',
        value:'2'
      },
      {
        label:'宿舍',
        value:'3'
      },{
        label:'会议室',
        value:'4'
      },
      {
        label:'仓库',
        value:'5'
      },
      {
        label:'阶梯教室',
        value:'7'
      },
      {
        label:'弱电间',
        value:'8'
      },
      {
        label:'其他',
        value:'6'
      }
    ]
    const room_type=[
      {
        label:'实训室',
        value:'0'
      },
      {
        label:'办公室',
        value:'1'
      },
      {
        label:'会议室',
        value:'4'
      },
      {
        label:'仓库',
        value:'5'
      },
      {
        label:'阶梯教室',
        value:'7'
      },
      {
        label:'弱电间',
        value:'8'
      },
      {
        label:'其他',
        value:'6'
      }
    ]
    const  assets_code=[{label:"教学设备",value:"0"},{label:"家具、用具",value:"1"},{label:"课桌椅",value:"2"},{label:"电器设备",value:"3"}
      ,{label:"办公自动化设备",value:"4"},{label:"电脑",value:"5"},{label:"笔记本电脑",value:"6"},{label:"专用设备",value:"7"},
      ,{label:"房屋建筑",value:"8"},{label:"图书及设备",value:"9"},{label:"其他",value:"10"}
    ]
  const LEARN_TERM=[
      {
        label:'第一学期',
        value:'1'
      },
      {
        label:'第二学期',
        value:'2'
      }
    ]
    const purchasingType=[
      {
        label:'货物类',
        value:'0'
      },
      {
        label:'服务类',
        value:'1'
      },
      {
        label:'工程类',
        value:'2'
      },
    ]
    const ckSure=[
      {
        label:'仓库待确认',
        value:'0'
      },{
        label:'仓库已确认',
        value:'1'
      }
    ]
    const lvBack=[
      {
        label:'未回退',
        value:'0'
      },{
        label:'仓库待确认',
        value:'1'
      },{
        label:'仓库已确认 ',
        value:'2'
      },
    ]
    const lyExamState=[
      {
        label:'待教研室确认',
        value:'-1'
      },
      {
        label:'待教务审核',
        value:'0'
      },{
        label:'通过',
        value:'1'
      },{
        label:'驳回',
        value:'2'
      },{
        label:'撤回',
        value:'3'
      },
    ]
    const pdState=[
      {
        label:'已盘点',
        value:'0'
      },
      {
        label:'待审核',
        value:'1'
      },
      {
        label:'通过',
        value:'2'
      },
      {
        label:'驳回',
        value:'3'
      },
      {
        label:'待盘点',
        value:'4'
      }
    ]
    const STATION_TYPE = [
      {
        label:'专技',
        value:'专技'
      },{
        label:'管理',
        value:'管理'
      },{
        label:'工勤',
        value:'工勤'
      },
    ]

    const SCORE_TYPE=[
      {
        label:'总评成绩',
        value:'total_mark'
      },
      {
        label:'平时成绩',
        value:'normal_score'
      },
      {
        label:'期中成绩',
        value:'midterm_score'
      },
      {
        label:'期末成绩',
        value:'final_score'
      }
    ]

    const assets_type=[
      {label:"通用设备",value:"1"},
      {label:"专用设备",value:"2"},
      {label:"图书档案",value:"3"},
      {label:"家具用具装具及动植物",value:"4"},
      {label:"文物和陈列品",value:"5"},
      {label:"房屋及构筑物",value:"6"},
      {label:"信息数据",value:"7"},
      {label: "车辆", value: "8"}
    ]

    const LEARN_TERM_FOR_INT=[
      {
        label:'第一学期',
        value:1
      },
      {
        label:'第二学期',
        value:2
      }
    ]

    const TEACH_PLAN_ASSIGN_CHECK_STATUS=[
      {
        label:'未锁定',
        value:'0'
      },
      {
        label:'锁定',
        value:'10'
      }
    ]

  const REXAM_TYPE=[
    {
      label:'补考',
      value:'1'
    },
    {
      label:'重修',
      value:'2'
    }
  ]

  const ABNORMAL_TYPE=[
    {
      label:'作弊',
      value:1
    },
    {
      label:'免修',
      value:2
    },
    {
      label:'取消资格',
      value:3
    },
    {
      label:'旷考',
      value:4
    },
    {
      label:'违纪',
      value:20
    },
    {
      label:'缓考',
      value:5
    },
     {
           label:'退学',
             value:10
         },
    {
      label:'休学',
        value:11
    }

  ]

    const MY_ABNORMAL_TYPE=[
        {
            label:1,
            value:'作弊'
        },
        {
            label:2,
            value:'免修'
        },
        {
            label:3,
            value:'取消资格'
        },
        {
            label:4,
            value:'旷考'
        },
      {
        label:20,
        value:'违纪'
      },
        {
            label:5,
            value:'缓考'
        },
        {
          label:10,
          value:'退学'
        },
        {
          label:11,
          value:'休学'
        }
    ]



    // const SCORE_LEVEL_AND_ABNORMAL=[
    //   {
    //     value:'优秀',
    //     label:0
    //   },
    //   {
    //     value:'良好',
    //     label:1
    //   },
    //   {
    //     value:'合格',
    //     label:2
    //   },
    //   {
    //     value:'不合格',
    //     label:3
    //   },
    //   {
    //     label:4,
    //     value:'作弊'
    //   },
    //   {
    //     label:5,
    //     value:'免修'
    //   },
    //   {
    //     label:6,
    //     value:'取消资格'
    //   },
    //   {
    //     label:7,
    //     value:'旷考'
    //   },
    //   {
    //     label:8,
    //     value:'缓考'
    //   }
    // ]

    const POINT_TYPE=[
      {
        label:'百分制',
        value:"0"
      },
      {
        label:'等级制',
        value:"1"
      }
    ]

  const SCORE_LEVEL=[
    {
      label:'优秀',
      value:"1"
    },
    {
      label:'良好',
      value:"2"
    },
    {
      label:'合格',
      value:"3"
    },
    {
      label:'不合格',
      value:"4"
    },
      {
          label:'中等',
          value:"5"
      }
  ]

    const SORT_MENU=[
      {
        label:'正序',
        value:0
      },
      {
        label:'倒序',
        value:1
      }
    ]

    const TYPE_MENU=[
      {
        label:'校内',
        value:'0'
      },
      {
        label:'校外',
        value:'1'
      }
    ]

    const CLASS_STATUS=[
      {label:"在校",value:"0"},
      {label:"顶岗",value:"1"},
      {label:"更岗",value:"2"},
      {label:"离校",value:"3"}
    ]

    const DICT_DORM_SIGN_STATUS=[
      {label:"已到",value:"0"},
      {label:"未到",value:"1"},
      {label:"请假",value:"2"},
      {label:"未点名",value:"3"},
    ]

    const DICT_DORM_SIGN_TYPE=[
      {label:"住宿点名",value:"1"},
      {label:"留宿点名",value:"2"},
    ]

    const DEVICE_IN_OUT_FLAG= [
      {label: "出", value: "1"},
      {label: "进", value: "0"}
    ]

    const DEVICE_ILLEGAL_OPTION=[
      {label: '是', value: '1'},
      {label: '否', value: '0'}
    ]

    const POSITION_TYPE_DATA=[
      {label:"大门",value:"1"},
      {label:"宿舍",value:"2"},
    ]

    const ORDER_BATCH_STATUS_DATA=[
      {label:'已提交，未付讫',value:'1'},
      {label:'已付讫',value:'2'}
    ]

    const DICT_ACESS_DEPT_TYPE=[
      {label:"部门",value:"1"},
      {label:"单位",value:"2"},
    ]


    const STU_GRADU_CHECK_DIC=[
      {label:"待审核",value:"0"},
      {label:"通过",value:"1"},
      {label:"驳回",value:"-1"},
    ]

    const WORKSTUDY_ATTENDANCE=[
      {label:'到岗',value:'1'},
      {label:'未到岗',value:'2'},
      {label:'请假',value:'3'},
    ]

    const INTERVIEW_DIC = [
      {label:'未面试',value:'0'},
      {label:'面试通过',value:'1'},
      {label:'面试未通过',value:'-1'},
    ]
    const ZLSH =[
      {label:'未填写',value:'0'},
      {label:'待审核',value:'1'},
      {label:'通过',value:'2'},
      {label:'驳回',value:'3'},
    ]


    const TEACHER_EVALUATE_STATUS=[
      {label:'未跟踪',value:'0'},
      {label:'已跟踪',value:'100'},
      {label:'驳回',value:'-1'},
    ]
    function showSuccessInfo(obj,msg){
    obj.$notify({
      title: '成功',
      message: msg,
      type: 'success',
    });
  }

  function showErrorInfo(obj,msg,time){
    obj.$notify.error({
      title: '错误',
      message: msg,
      duration: time
    });
  }

    function showToastErrorInfo(obj,msg,time){
      obj.$notify.error({
        title: '错误',
        dangerouslyUseHTMLString:true,
        message: msg,
        duration: time
      });
    }

    function showErrorInfoForSelfTitle(obj,msg,time,title){
      obj.$notify.error({
        title: title,
        message: msg,
        duration: time
      });
    }

  function showWarningInfo(obj,msg,time){
    obj.$notify({
      title: '警告',
      message: msg,
      type: 'warning',
      duration: time
    });
  }

  function compareDate (d1, d2) {
    let reg = new RegExp('-', 'g')
    return ((new Date(d1.replace(reg, '/'))) > (new Date(d2.replace(reg, '/'))))
  }

    function exportExcelForModel(form,url) {
      return axios({ // 用axios发送post请求
        method: 'post',
        url: url, // 请求地址
        data: form, // 参数
        responseType: 'blob', // 表明返回服务器返回的数据类型
        headers: {
          'Content-Type': 'application/json'
        }
      })
    }

    // //导出
    function exportForModel(params,fileNameStr,url){
      exportExcelForModel(params,url).then(res => { // 处理返回的文件流
        console.log(res)
        const blob = new Blob([res.data]);
        const fileName = fileNameStr;
        const elink = document.createElement('a');
        elink.download = fileName;
        elink.style.display = 'none';
        elink.href = URL.createObjectURL(blob);
        document.body.appendChild(elink);
        elink.click();
        URL.revokeObjectURL(elink.href); // 释放URL 对象
        document.body.removeChild(elink);
      })
    }

    function exportForModelGet(params,fileNameStr,url){
      exportExcelForModelGet(params,url).then(res => { // 处理返回的文件流
        console.log(res)
        const blob = new Blob([res.data]);
        const fileName = fileNameStr;
        const elink = document.createElement('a');
        elink.download = fileName;
        elink.style.display = 'none';
        elink.href = URL.createObjectURL(blob);
        document.body.appendChild(elink);
        elink.click();
        URL.revokeObjectURL(elink.href); // 释放URL 对象
        document.body.removeChild(elink);
      })
    }

    function exportExcelForModelGet(form,url) {
      return axios({ // 用axios发送post请求
        method: 'get',
        url: url, // 请求地址
        responseType: 'blob', // 表明返回服务器返回的数据类型
        headers: {
          'Content-Type': 'application/json'
        }
      })
    }

  function checkAbnormalType(type) {
    ABNORMAL_TYPE.forEach(item => {
        if (type === item.value){
          return item.label
        }
      })
  }

  function getSqlSort(sort){
      let sortRet = "";
      if(sort == 'descending'){
        sortRet = 'desc'
      }else{
        sortRet = 'asc'
      }
      return sortRet;
  }

    function copyText(data,that){
      let url = data
      let oInput = document.createElement('input')
      oInput.value = url
      document.body.appendChild(oInput)
      oInput.select() // 选择对象
      document.execCommand("Copy") // 执行浏览器复制命令
      showSuccessInfo(that,"复制成功")
      oInput.remove()
    }

    //根据字典集合  和 字典key  查找label值
    function getLabelValue(list,key){
      for(let i in list){
        if(list[i].value==key){
          return list[i].label
        }
      }
    }
    //根据字典集合  和 字典key  查找label值
    function getLabelValueByArr(list,key){
      let arr = key.split(",")
      let backValue="";
      for(let i in arr){
        for (let j in list){
          if(list[j].value==arr[i]){
            backValue=backValue+","+list[j].label
          }
        }
      }
      return backValue==""?"":backValue.substring(1,backValue.length);
    }
    function getLabelValueByPropes(list,key,props){
      for(let i in list){
        if(list[i][props.key]==key){
          return list[i][props.value]
        }
      }
    }
    function getLabelValueByPropes2(list,key,props){
      for(let i in list){
        if(list[i][props.key]==key){
          return list[i][props.value]+' || '+list[i]['xz']+" 年制"
        }
      }
    }
    export default
    {
        HEATH,
        TEACHER_CATE,
        changeState,
        YES_OR_NO,
        YES_OR_NO_INT,
        LOCK_STATUS,
        RECORD_STATUS,
        LEARN_TERM,
      purchasingType,
      pdState,
      lyExamState,
      lvBack,
      ckSure,
      STATION_TYPE,
      assets_type,
      assets_code,
        room_type,
      all_room_type,
      all_room_type_id,
      transferState,
      invalidState,
      POINT_SYSTEM,
        SCORE_TYPE,
        ABNORMAL_TYPE,
        MY_ABNORMAL_TYPE,
        LEARN_TERM_FOR_INT,
        TEACH_PLAN_ASSIGN_CHECK_STATUS,
        SORT_MENU,
        TYPE_MENU,
        PROJECT_UP,
        PROJECT_OTHER,
        combineTaxUrl,
        getTaxUrl,
        TAX_BASE_URL,
        TAX_USER_SYNC_URL,
        ADM_DIV_CODE,
        AGENCY_CODE,
        TEST_TOKEN,
        METHOD_THEME,
        METHOD_BUSINESS,
        METHOD_BUSINESS_SEARCH,
        METHOD_PAY,
        showSuccessInfo,
        showErrorInfo,
        showToastErrorInfo,
        showErrorInfoForSelfTitle,
        showWarningInfo,
        compareDate,
        checkAbnormalType,
        COURSE_SIGN_STATUS,
        COURSE_OPEND_STATUS,
        SCORE_LEVEL,
        SCORE_LEVEL_INT,
        EXAM_STATUS,
        REXAM_TYPE,
        exportForModel,
      exportForModelGet,
        getSqlSort,
        POINT_TYPE,
       CLASS_STATUS,
      KNOWLEDGE_EXAM,
      copyText,
      getLabelValue,
      getLabelValueByArr,
      getLabelValueByPropes,
      getLabelValueByPropes2,
      DICT_DORM_SIGN_STATUS,
      DICT_DORM_SIGN_TYPE,
      DEVICE_IN_OUT_FLAG,
      DEVICE_ILLEGAL_OPTION,
      POSITION_TYPE_DATA,
      ORDER_BATCH_STATUS_DATA,
      DICT_ACESS_DEPT_TYPE,
      STU_GRADU_CHECK_DIC,
      WORKSTUDY_ATTENDANCE,
      INTERVIEW_DIC,
      ZLSH,
      TEACHER_EVALUATE_STATUS
    }
</script>
