import request from '@/assets/js/utils/request'
import { createURL } from '@/assets/js/utils'
// 插件
import { Base64 } from 'js-base64'
// 获取时间
export function getTime(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/base/getTime',
    method: 'post',
    data
  })
}

// 获取【组件封装】品目树
export function getPurcatalogCategoryTree(data) {
  return request({
    url: '/bidprocurement/common-tools/tool/purcatalogCategory/getPurcatalogCategoryTree',
    method: 'post',
    data
  })
}
// 获取【组件封装】品目树
export function getPurcatalogCategoryTreeBySearch(data) {
  return request({
    url: '/bidprocurement/common-tools/tool/purcatalogCategory/getPurcatalogCategoryTreeBySearch',
    method: 'post',
    data
  })
}

// 入库专业-获取【组件封装】品目树
export function getPurcatalogProfessionalTree(data) {
  return request({
    url: '/bidprocurement/common-tools/purcatalog/purcatalogProfessionalController/getPurcatalogProfessionalTree',
    method: 'post',
    data
  })
}

// 获取系统配置
export function getSystemConfigByConfigType(data) {
  return request({
    url: '/bidprocurement/common-tools/systemConfig/getSystemConfigByConfigType' + createURL(data),
    method: 'post'
  })
}

/* ============================字典信息========================*/
// 保存数据字典分类信息
export function saveTypeGroup(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/saveTypeGroup' + createURL(data),
    method: 'post'
  })
}
// 修改数据字典分类信息
export function updateTypeGroup(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/updateTypeGroup' + createURL(data),
    method: 'post'
  })
}

// 删除数据字典分类信息
export function delTypeGroup(id) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/delTypeGroup?id=' + id,
    method: 'post'
  })
}

// 保存数据字典类型信息
export function saveType(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/saveType' + createURL(data),
    method: 'post'
  })
}

// 修改数据字典类型信息
export function updateType(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/updateType' + createURL(data),
    method: 'post'
  })
}

// 删除数据字典类型信息
export function delType(id) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/delType?id=' + id,
    method: 'post'
  })
}

// 字典信息
export function initWebTypeGroup(groupCode) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/initWebTypeGroup?groupCode=' +
      groupCode,
    method: 'post'
  })
}

// 获取数据字典分类列表信息
export function getTypeGroupList(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/getTypeGroupList' + createURL(data),
    method: 'post'
  })
}

// 获取数据字典类型列表信息
export function getTypeList(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/baseTypeGroup/typegroup/getTypeList' + createURL(data),
    method: 'post'
  })
}
// 加密的盐值-地址加密获取图片
export function getLoginRegistImage(imagePath) {
  imagePath = Base64.encode('1be004824634e083464eef19cadb7e51' + Base64.decode(imagePath))
  return '/bidprocurement/common-tools/tools/commonUpload/getLoginRegistImage?imagePath=' + imagePath
}

/*
 * 范本库
 * */
// 添加或者修改范本库信息
export function addOrUpdateTmplateLibrary(data) {
  return request({
    url:
      '/bidprocurement/common-tools/templateLibrary/addOrUpdateTmplateLibrary',
    method: 'post',
    data
  })
}
// 模板库-获取模板列表
export function getTemplateLibraryList(data) {
  return request({
    url:
      '/bidprocurement/common-tools/templateLibrary/getTemplateLibraryList',
    method: 'post',
    data
  })
}
// 根据id删除范本模板信息
export function deleteTemplateLibraryById(data) {
  return request({
    url:
      '/bidprocurement/common-tools/templateLibrary/deleteTemplateLibraryById?templateLibraryId=' + data,
    method: 'post'
  })
}
// 根据id获取范本模板信息
export function getTemplateLibraryById(data) {
  return request({
    url:
      '/bidprocurement/common-tools/templateLibrary/getTemplateLibraryById?templateLibraryId=' + data,
    method: 'post'
  })
}

/* ================================业务参数设置======================*/
// 获取系统时间配置列表
export function getSystemTimeConfig() {
  return request({
    url: '/bidprocurement/common-tools/systemTimeConfig/getSystemTimeConfig',
    method: 'get'
  })
}

// 保存系统时间配置
export function saveOfupdateSystemTimeConfig(data) {
  return request({
    url: '/bidprocurement/common-tools/systemTimeConfig/saveOfupdateSystemTimeConfig',
    method: 'post',
    data
  })
}

// 查询短信模板
export function selectSmsSendTemplateList(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/sms/publicSmsSendTemplate/selectSmsSendTemplateList',
    method: 'post',
    data
  })
}
// 自定义短信发送
export function customSmsSending(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/sms/smsSendCustom/customSmsSending',
    method: 'post',
    data
  })
}

// 根据id批量删除短信模板
export function deleteSmsTemplateInfoById(ids) {
  return request({
    url: '/bidprocurement/common-tools/tools/sms/publicSmsSendTemplate/deleteSmsTemplateInfoById?ids=' + ids,
    method: 'post'
  })
}

// 保存短信模板
export function saveOrUpdateSmsTemplate(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/sms/publicSmsSendTemplate/saveOrUpdateSmsTemplate',
    method: 'post',
    data
  })
}
// 根据id查询短信模板
export function selectSmsTemplateInfoById(id) {
  return request({
    url: '/bidprocurement/common-tools/tools/sms/publicSmsSendTemplate/selectSmsTemplateInfoById?id=' + id,
    method: 'post'
  })
}

// 获取当前用户登录角色对应的操作手册文件
export function getRoleDownLoadFile() {
  return request({
    url: '/bidprocurement/common-tools/tools/commonUpload/getRoleDownLoadFile',
    method: 'get'
  })
}

// 获取法定节假日
export function getHoliday(params) {
  return request({
    url: '/bidprocurement/common-tools/tools/calendar/getHoliday',
    method: 'post',
    params
  })
}
// 获取工作日天数
export function getThisTimeRangeHoliday(data) {
  return request({
    url: '/bidprocurement/common-tools/tools/calendar/getThisTimeRangeHoliday',
    method: 'post',
    data
  })
}
