7843740335cf3ebd75169aaa99f498b3b07ef785.svn-base 5.3 KB

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