xm-law-feedback-open-handler.js 922 B

123456789101112131415161718192021222324252627
  1. import axios from '@/common/services/axios-instance'
  2. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  3. export default function ({ button, eventScript, context: { args, dataList, fieldInfos } }) {
  4. return new Promise((resolve) => {
  5. const record = args[0]
  6. axios({
  7. url: `api/framework/v1/task-form-process/done-pages/${record.instId}`,
  8. method: 'get',
  9. }).then((res) => {
  10. let url = ''
  11. const todoInfo = res.data.buttons.find((f) => f.buttonId === 'workflow$openTodo')
  12. if (todoInfo) {
  13. url = '/sd-webflow/todo-pages/' + todoInfo.attrs.todoId
  14. } else {
  15. url = '/sd-webflow/done-pages/' + record.instId
  16. }
  17. // window.open(url, '_blank')
  18. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  19. if (refreshFlag) {
  20. this.$refs[this.activeKey][0].refresh(true)
  21. }
  22. })
  23. resolve()
  24. })
  25. })
  26. }