| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import store from '@/store'
- // 请求头文件
- export function axiosRequestParams(_this) {
- return {
- timeout: 20000,
- baseURL: process.env.VUE_APP_BASE_URL,
- headers: {
- Authorization: 'Bearer ' + store.getters.woptoken,
- Identifier: store.getters.wopidntf
- }
- }
- }
- // 自定义按钮
- export function custFormBtnList(type = 3) {
- const bottonList = {
- iShow: true,
- list: []
- }
- const btnList = []
- if ((type & 1) == 1) {
- btnList.push({ bType: 'info', icon: 'el-icon-close', type: 'cancel', label: '取消' })
- }
- if ((type & 2) == 2) {
- btnList.push({ bType: 'primary', icon: 'el-icon-check', type: 'ok', label: '确认' })
- }
- bottonList.list = btnList
- return bottonList
- }
- // form表单按钮 type:5 使用默认保存功能
- export function custFormBtnListNew(type = 4) {
- const rv = custFormBtnList()
- if (type === 4) {
- rv.list[0].type = 'close'
- rv.list[1].type = 'submit'
- }
- return rv
- }
- /** 装饰数据行,装饰后可使用nt-from表单默认保存功能 */
- export function decorateSaveRow(row, ext) {
- row._btn = custFormBtnListNew(4)
- row._axios = axiosRequestParams()
- row._url = ext.url
- row._method = 'post'
- row._oldData = Object.assign({}, row)
- return row
- }
|