xm-law-team-export-handler.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <script>
  2. import download from '@/common/services/download'
  3. import axios from '@/common/services/axios-instance'
  4. import { Modal } from 'ant-design-vue'
  5. import components from './_import-components/xm-law-team-export-handler-import'
  6. export default {
  7. name: 'XmLawTeamExportHandler',
  8. components,
  9. data() {
  10. return {}
  11. },
  12. methods: {
  13. run({ button, eventScript, context: { args, dataList } }) {
  14. // 导出
  15. const fe = dataList.filterExpressions
  16. const exs = fe.find((i) => {
  17. return i.name === 'OWNER_ORG_ID'
  18. })
  19. const params = {
  20. configId: '251',
  21. selectIds: [],
  22. expressions: exs || [],
  23. }
  24. return axios({
  25. method: 'post',
  26. url: 'api/xcoa-mobile/v1/iam-excel-export/excelExport',
  27. data: params,
  28. responseType: 'blob',
  29. }).then((res) => {
  30. if (res.status === 200) {
  31. const url = URL.createObjectURL(res.data)
  32. const filename = res.headers['content-disposition']
  33. const fname = filename.substring(filename.indexOf('filename=') + 9, filename.length)
  34. download(url, decodeURI(fname))
  35. } else {
  36. Modal.warning({
  37. title: '提示',
  38. content: '导出报错,请联系管理员!',
  39. })
  40. return false
  41. }
  42. })
  43. },
  44. },
  45. }
  46. </script>
  47. <style module lang="scss">
  48. @use '@/common/design' as *;
  49. </style>