xm-law-team-detail-handler.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { message } from 'ant-design-vue'
  2. import XmSingleDataService from './xm-single-data-service'
  3. export default function({ button, eventScript, context: { args, dataList, fieldInfos } }) {
  4. return new Promise((resolve) => {
  5. const record = args[0]
  6. let href = ''
  7. const orgId = fieldInfos.find((f) => f.name === 'OWNER_ORG_ID')?.value
  8. if (orgId) {
  9. // 判断是否有查看权限
  10. XmSingleDataService.lawTeamDetail(orgId)
  11. .then((res) => {
  12. if (res.data) {
  13. // 打开详情页
  14. if (record.openLink) {
  15. // href =
  16. // '#/sd-webflow/' + task.openLink?.split('task-form-process/')[1] + '/' + task[task.openParam]
  17. href = '#/sd-webflow/done-pages/' + record.instId
  18. }
  19. window.open(href, '_blank')
  20. } else {
  21. message.error('您没有查看权限。')
  22. }
  23. })
  24. .catch((e) => {
  25. // eslint-disable-next-line no-console
  26. console.log(e)
  27. message.error('出错了,请联系管理员')
  28. })
  29. .finally(() => {
  30. resolve()
  31. })
  32. } else {
  33. // 所属组织机构没有值时直接打开
  34. if (record.openLink) {
  35. href = '#/sd-webflow/done-pages/' + record.instId
  36. }
  37. window.open(href, '_blank')
  38. resolve()
  39. }
  40. })
  41. }