public.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import { tableDelApi } from '@/api/common';
  11. export function modalSure(delfromData) {
  12. return new Promise((resolve, reject) => {
  13. let content = `<p>确定要${delfromData.title}吗?</p>`;
  14. if (delfromData.info !== undefined) {
  15. content = content + `<p>${delfromData.info}</p>`;
  16. }
  17. this.$Modal.confirm({
  18. title: delfromData.title,
  19. content: content,
  20. loading: true,
  21. onOk: () => {
  22. setTimeout(() => {
  23. this.$Modal.remove();
  24. if (delfromData.success) {
  25. delfromData.success
  26. .then(async (res) => {
  27. resolve(res);
  28. })
  29. .catch((res) => {
  30. reject(res);
  31. });
  32. } else {
  33. tableDelApi(delfromData)
  34. .then(async (res) => {
  35. resolve(res);
  36. })
  37. .catch((res) => {
  38. reject(res);
  39. });
  40. }
  41. }, 300);
  42. },
  43. onCancel: () => {
  44. this.$Message.info('取消成功');
  45. },
  46. });
  47. });
  48. }