2594b22a4c8a8517ba603b4c77ba847e6c96a85e.svn-base 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. import request from '@/utils/request'
  2. import parseTime from '@/utils/index.js'
  3. export function GetDataByName(data) {
  4. return request({
  5. url: '/authdata/GetDataByName',
  6. method: 'post',
  7. data
  8. })
  9. }
  10. export function GETNurJudge(data) {
  11. return request({
  12. url: '/authdata/GETNurJudge',
  13. method: 'post',
  14. data
  15. })
  16. }
  17. export function GETNurJudgeRport(data) {
  18. return request({
  19. url: '/authdata/GETNurJudgeRport',
  20. method: 'post',
  21. data
  22. })
  23. }
  24. export function ExeSqlJiade(data) {
  25. return request({
  26. url: '/authdata/exesql',
  27. method: 'post',
  28. data
  29. })
  30. }
  31. export function dashboardListJiade(data) {
  32. return request({
  33. url: '/authdata/Dashboards',
  34. method: 'post',
  35. data
  36. })
  37. }
  38. export function updateDashboardJiade(data) {
  39. return request({
  40. url: '/authdata/Updatedashboard',
  41. method: 'post',
  42. data
  43. })
  44. }
  45. export function GetReportform(data) {
  46. return request({
  47. url: '/authdata/GetReportform',
  48. method: 'post',
  49. data
  50. })
  51. }
  52. export function requestbyname(data, requestname) {
  53. return request({
  54. url: '/authdata/' + requestname,
  55. method: 'post',
  56. data
  57. })
  58. }
  59. export function GetDataByNameXlsx(data) {
  60. return request({
  61. url: '/authdata/GetDataByName',
  62. method: 'post',
  63. data,
  64. responseType: 'blob'
  65. })
  66. }
  67. export function GetDataByNames(data) {
  68. return request({
  69. url: '/authdata/GetDataByNames',
  70. method: 'post',
  71. data
  72. })
  73. }
  74. export function PostDataByName(data) {
  75. return request({
  76. url: '/authdata/PostDataByName',
  77. method: 'post',
  78. data
  79. })
  80. }
  81. export function GetUpkeepPlan(data) {
  82. return request({
  83. url: '/authdata/GetUpkeepPlan',
  84. method: 'post',
  85. data
  86. })
  87. }
  88. export function GetAccount(data) {
  89. return request({
  90. url: '/authdata/GetAccount',
  91. method: 'post',
  92. timeout: 600000,
  93. data
  94. })
  95. }
  96. export function GetArrList(data) {
  97. return request({
  98. url: '/authdata/GetArrList',
  99. method: 'post',
  100. data
  101. })
  102. }
  103. export function PostDataByNames(data) {
  104. return request({
  105. url: '/authdata/PostDataByNames',
  106. method: 'post',
  107. data
  108. })
  109. }
  110. export function ExecDataByConfig(data) {
  111. return request({
  112. url: '/authdata/ExecDataByConfig',
  113. method: 'post',
  114. data
  115. })
  116. }
  117. export function removeimage(data) {
  118. return request({
  119. url: '/authdata/removeimage',
  120. method: 'post',
  121. data
  122. })
  123. }
  124. export function getRecuData(data) {
  125. return request({
  126. url: '/authdata/GetRecuDataByName',
  127. method: 'post',
  128. data
  129. })
  130. }
  131. export function failproccess(data, notify) {
  132. if (data.data.includes('Duplicate')) {
  133. notify({
  134. title: '失败',
  135. message: '不可以录入重复数据',
  136. type: 'error',
  137. duration: 2000
  138. })
  139. } else {
  140. notify({
  141. title: '失败',
  142. message: '数据存在错误,请校验好重新录入,不可以录入数据',
  143. type: 'error',
  144. duration: 2000
  145. })
  146. }
  147. }
  148. export function UpdateDataRelation(data) {
  149. return request({
  150. url: '/authdata/UpdateDataRelation',
  151. method: 'post',
  152. data
  153. })
  154. }
  155. export function transData(a, idStr, pidStr, chindrenStr) {
  156. var r = []; var hash = {}; var id = idStr; var pid = pidStr; var children = chindrenStr; var i = 0; var j = 0; var len = a.length
  157. for (; i < len; i++) {
  158. hash[a[i][id]] = a[i]
  159. }
  160. for (; j < len; j++) {
  161. var aVal = a[j]; var hashVP = hash[aVal[pid]]
  162. if (hashVP) {
  163. !hashVP[children] && (hashVP[children] = [])
  164. hashVP[children].push(aVal)
  165. } else {
  166. r.push(aVal)
  167. }
  168. }
  169. return r
  170. }
  171. export function checkButtons(buttonsList, PermissionButtons) {
  172. // console.log(PermissionButtons)
  173. for (let i = 0; i < buttonsList.length; i++) {
  174. // if (buttonsList[i].path === PermissionButtons && buttonsList[i].menu_id && buttonsList[i].path) { // path不为空且menu_id不为空时返回true
  175. if (buttonsList[i].path === PermissionButtons && buttonsList[i].editbutton === 1) { // path不为空且menu_id不为空时返回true
  176. return true
  177. }
  178. }
  179. return false
  180. }
  181. export function formatJson(filterVal, jsonData) {
  182. return jsonData.map(v =>
  183. filterVal.map(j => {
  184. if (j === 'timestamp') {
  185. return parseTime(v[j])
  186. } else {
  187. return v[j]
  188. }
  189. })
  190. )
  191. }
  192. export function DownloadExcel(data, filename) {
  193. const content = data
  194. const blob = new Blob([content])
  195. const fileName = filename + '.xlsx'
  196. if ('download' in document.createElement('a')) { // 非IE下载
  197. const elink = document.createElement('a')
  198. elink.download = fileName
  199. elink.style.display = 'none'
  200. elink.href = URL.createObjectURL(blob)
  201. document.body.appendChild(elink)
  202. elink.click()
  203. URL.revokeObjectURL(elink.href) // 释放URL 对象
  204. document.body.removeChild(elink)
  205. } else { // IE10+下载
  206. navigator.msSaveBlob(blob, fileName)
  207. }
  208. }
  209. // 取小数
  210. export function formatNum(f, digit) {
  211. var m = Math.pow(10, digit);
  212. return parseInt(f * m, 10) / m;
  213. }
  214. export function compareSort(property){
  215. return function(a,b){
  216. var value1 = a[property];
  217. var value2 = b[property];
  218. return value1 - value2;
  219. }
  220. }