| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 | import request from '@/utils/request'import parseTime from '@/utils/index.js'export function GetDataByName(data) {  return request({    url: '/authdata/GetDataByName',    method: 'post',    data  })}export function ExeSqlJiade(data) {  return request({    url: '/authdata/exesql',    method: 'post',    data  })}export function dashboardListJiade(data) {  return request({    url: '/authdata/Dashboards',    method: 'post',    data  })}export function updateDashboardJiade(data) {  return request({    url: '/authdata/Updatedashboard',    method: 'post',    data  })}export function GetReportform(data) {  return request({    url: '/authdata/GetReportform',    method: 'post',    data  })}export function requestbyname(data, requestname) {  return request({    url: '/authdata/' + requestname,    method: 'post',    data  })}export function GetDataByNameXlsx(data) {  return request({    url: '/authdata/GetDataByName',    method: 'post',    data,    responseType: 'blob'  })}export function GetDataByNames(data) {  return request({    url: '/authdata/GetDataByNames',    method: 'post',    data  })}export function PostDataByName(data) {  return request({    url: '/authdata/PostDataByName',    method: 'post',    data  })}export function GetUpkeepPlan(data) {  return request({    url: '/authdata/GetUpkeepPlan',    method: 'post',    data  })}export function GetAccount(data) {  return request({    url: '/authdata/GetAccount',    method: 'post',    timeout: 600000,    data  })}export function GetArrList(data) {  return request({    url: '/authdata/GetArrList',    method: 'post',    data  })}export function PostDataByNames(data) {  return request({    url: '/authdata/PostDataByNames',    method: 'post',    data  })}export function ExecDataByConfig(data) {  return request({    url: '/authdata/ExecDataByConfig',    method: 'post',    data  })}export function removeimage(data) {  return request({    url: '/authdata/removeimage',    method: 'post',    data  })}export function getRecuData(data) {  return request({    url: '/authdata/GetRecuDataByName',    method: 'post',    data  })}export function failproccess(data, notify) {  if (data.data.includes('Duplicate')) {    notify({      title: '失败',      message: '不可以录入重复数据',      type: 'error',      duration: 2000    })  } else {    notify({      title: '失败',      message: '数据存在错误,请校验好重新录入,不可以录入数据',      type: 'error',      duration: 2000    })  }}export function UpdateDataRelation(data) {  return request({    url: '/authdata/UpdateDataRelation',    method: 'post',    data  })}export function transData(a, idStr, pidStr, chindrenStr) {  var r = []; var hash = {}; var id = idStr; var pid = pidStr; var children = chindrenStr; var i = 0; var j = 0; var len = a.length  for (; i < len; i++) {    hash[a[i][id]] = a[i]  }  for (; j < len; j++) {    var aVal = a[j]; var hashVP = hash[aVal[pid]]    if (hashVP) {      !hashVP[children] && (hashVP[children] = [])      hashVP[children].push(aVal)    } else {      r.push(aVal)    }  }  return r}export function checkButtons(buttonsList, PermissionButtons) {  // console.log(PermissionButtons)  for (let i = 0; i < buttonsList.length; i++) {    // if (buttonsList[i].path === PermissionButtons && buttonsList[i].menu_id && buttonsList[i].path) { // path不为空且menu_id不为空时返回true    if (buttonsList[i].path === PermissionButtons && buttonsList[i].editbutton === 1) { // path不为空且menu_id不为空时返回true      return true    }  }  return false}export function formatJson(filterVal, jsonData) {  return jsonData.map(v =>    filterVal.map(j => {      if (j === 'timestamp') {        return parseTime(v[j])      } else {        return v[j]      }    })  )}export function DownloadExcel(data, filename) {  const content = data  const blob = new Blob([content])  const fileName = filename + '.xlsx'  if ('download' in document.createElement('a')) { // 非IE下载    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)  } else { // IE10+下载    navigator.msSaveBlob(blob, fileName)  }}
 |