7a9bb26abe982b6c972f274cc4cfb4f57e3b8e53.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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 getDorm(data) {
  118. return request({
  119. url: '/authdata/getDorm',
  120. method: 'post',
  121. timeout: 6000000,
  122. data
  123. })
  124. }
  125. export function removeimage(data) {
  126. return request({
  127. url: '/authdata/removeimage',
  128. method: 'post',
  129. data
  130. })
  131. }
  132. export function getRecuData(data) {
  133. return request({
  134. url: '/authdata/GetRecuDataByName',
  135. method: 'post',
  136. data
  137. })
  138. }
  139. export function Autogeneration(data) {
  140. return request({
  141. url: '/authdata/autogeneration',
  142. method: 'post',
  143. data
  144. })
  145. }
  146. export function failproccess(data, notify) {
  147. if (data.data.includes('Duplicate')) {
  148. notify({
  149. title: '失败',
  150. message: '不可以录入重复数据',
  151. type: 'error',
  152. duration: 2000
  153. })
  154. } else {
  155. notify({
  156. title: '失败',
  157. message: '数据存在错误,请校验好重新录入,不可以录入数据',
  158. type: 'error',
  159. duration: 2000
  160. })
  161. }
  162. }
  163. export function UpdateDataRelation(data) {
  164. return request({
  165. url: '/authdata/UpdateDataRelation',
  166. method: 'post',
  167. data
  168. })
  169. }
  170. export function transData(a, idStr, pidStr, chindrenStr) {
  171. var r = []; var hash = {}; var id = idStr; var pid = pidStr; var children = chindrenStr; var i = 0; var j = 0; var len = a.length
  172. for (; i < len; i++) {
  173. hash[a[i][id]] = a[i]
  174. }
  175. for (; j < len; j++) {
  176. var aVal = a[j]; var hashVP = hash[aVal[pid]]
  177. if (hashVP) {
  178. !hashVP[children] && (hashVP[children] = [])
  179. hashVP[children].push(aVal)
  180. } else {
  181. r.push(aVal)
  182. }
  183. }
  184. return r
  185. }
  186. export function checkButtons(buttonsList, PermissionButtons) {
  187. // console.log(PermissionButtons)
  188. for (let i = 0; i < buttonsList.length; i++) {
  189. // if (buttonsList[i].path === PermissionButtons && buttonsList[i].menu_id && buttonsList[i].path) { // path不为空且menu_id不为空时返回true
  190. if (buttonsList[i].path === PermissionButtons && buttonsList[i].editbutton === 1) { // path不为空且menu_id不为空时返回true
  191. return true
  192. }
  193. }
  194. return false
  195. }
  196. export function formatJson(filterVal, jsonData) {
  197. return jsonData.map(v =>
  198. filterVal.map(j => {
  199. if (j === 'timestamp') {
  200. return parseTime(v[j])
  201. } else {
  202. return v[j]
  203. }
  204. })
  205. )
  206. }
  207. export function DownloadExcel(data, filename) {
  208. const content = data
  209. const blob = new Blob([content])
  210. const fileName = filename + '.xlsx'
  211. if ('download' in document.createElement('a')) { // 非IE下载
  212. const elink = document.createElement('a')
  213. elink.download = fileName
  214. elink.style.display = 'none'
  215. elink.href = URL.createObjectURL(blob)
  216. document.body.appendChild(elink)
  217. elink.click()
  218. URL.revokeObjectURL(elink.href) // 释放URL 对象
  219. document.body.removeChild(elink)
  220. } else { // IE10+下载
  221. navigator.msSaveBlob(blob, fileName)
  222. }
  223. }
  224. // 取小数
  225. export function formatNum(f, digit) {
  226. var m = Math.pow(10, digit);
  227. return parseInt(f * m, 10) / m;
  228. }
  229. export function compareSort(property){
  230. return function(a,b){
  231. var value1 = a[property];
  232. var value2 = b[property];
  233. return value1 - value2;
  234. }
  235. }