Blame view

src/utils/popup.js 1.74 KB
1 2 3
/*
 * @Description: 弹框组件的封装
 * @Autor: renchao
4
 * @LastEditTime: 2023-07-12 09:58:13
5
 */
6
import ywPopup from '@/components/ywPopup/index'
7
import Popup1 from '@/components/Popup1/index'
yuanbo committed
8 9 10 11 12 13 14 15 16 17 18 19 20
/**
 * @description: popupDialog
 * @param {*} title
 * @param {*} url
 * @param {*} params
 * @param {*} width
 * @param {*} isMain
 * @param {*} height
 * @param {*} btnShow
 * @param {*} callback
 * @param {*} cancel
 * @author: renchao
 */
21
export function popupDialog (title, url, params, width = '75%', isMain, height, btnShow = false, callback, cancel) {
22 23
  // Popup.install
  Popup1(title, url, {
任超 committed
24 25 26 27
    height: height,
    width: width,
    formData: params,
    btnShow: btnShow,
28
    isMain: isMain,
任超 committed
29
    cancel: () => {
30
      cancel()
任超 committed
31 32
    },
    confirm: () => {
33
      callback()
34 35 36 37 38
    },
    popupDialog: popupDialog // 将 popupDialog 方法传递给弹框组件
  })
}

yuanbo committed
39 40 41 42 43 44 45 46 47 48 49 50 51
/**
 * @description: ywPopupDialog
 * @param {*} title
 * @param {*} url
 * @param {*} params
 * @param {*} width
 * @param {*} isMain
 * @param {*} height
 * @param {*} btnShow
 * @param {*} callback
 * @param {*} cancel
 * @author: renchao
 */
52
export function ywPopupDialog (title, url, params, width = '75%', isMain, height, btnShow = true, callback, cancel) {
53 54 55 56 57 58 59 60 61 62 63 64 65 66
  // Popup.install
  ywPopup(title, url, {
    height: height,
    width: width,
    formData: params,
    btnShow: btnShow,
    isMain: isMain,
    cancel: () => {
      cancel()
    },
    confirm: () => {
      callback()
    },
    popupDialog: popupDialog // 将 popupDialog 方法传递给弹框组件
任超 committed
67
  })
68
}
任超 committed
69

yuanbo committed
70 71 72 73
/**
 * @description: popupCacel
 * @author: renchao
 */
74 75
export function popupCacel () {
  Popup1().close()
76
}
yuanbo committed
77 78 79 80 81

/**
 * @description: ywPopupCacel
 * @author: renchao
 */
82 83
export function ywPopupCacel () {
  ywPopupDialog().close()
yuanbo committed
84
}