xm-cpm-workpaper-renew-handler.js 915 B

1234567891011121314151617181920212223242526272829
  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 wid = fieldInfos?.find((item) => item.name === 'id').value
  6. const projectId = fieldInfos?.find((item) => item.name === 'PROJECT_ID').value
  7. if (wid) {
  8. // 调用接口
  9. const param = []
  10. param.push(wid)
  11. XmSingleDataService.againFlow(param, projectId)
  12. .then((res) => {
  13. if (res.status === 200) {
  14. message.success('重新起草成功')
  15. resolve()
  16. // 刷新
  17. setTimeout(() => {
  18. dataList.refresh()
  19. }, 1000)
  20. }
  21. })
  22. .catch((e) => {
  23. message.error('重新起草失败,请联系管理员')
  24. resolve()
  25. })
  26. }
  27. })
  28. }