parent
c7e48d2706
commit
b10d0e148a
17 changed files with 429 additions and 244 deletions
@ -0,0 +1,34 @@ |
|||||||
|
import request from '@/router/axios'; |
||||||
|
|
||||||
|
// =====================参数===========================
|
||||||
|
|
||||||
|
export const historyFlowList = (current, size, params) => { |
||||||
|
return request({ |
||||||
|
url: '/api/blade-flow/process/history-flow-list', |
||||||
|
method: 'get', |
||||||
|
params: { |
||||||
|
...params, |
||||||
|
current, |
||||||
|
size, |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// =====================请假流程===========================
|
||||||
|
|
||||||
|
export const leaveProcess = (data) => { |
||||||
|
return request({ |
||||||
|
url: '/api/blade-desk/process/leave/start-process', |
||||||
|
method: 'post', |
||||||
|
data |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export const leaveDetail = (params) => { |
||||||
|
return request({ |
||||||
|
url: '/api/blade-desk/process/leave/detail', |
||||||
|
method: 'get', |
||||||
|
params |
||||||
|
}) |
||||||
|
} |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
import {getStore, setStore} from '@/util/store' |
||||||
|
|
||||||
|
import {getDictionary} from '@/api/system/dict' |
||||||
|
|
||||||
|
const dict = { |
||||||
|
state: { |
||||||
|
flowRoutes: getStore({name: 'flowRoutes'}) || {}, |
||||||
|
}, |
||||||
|
actions: { |
||||||
|
//发送错误日志
|
||||||
|
FlowRoutes({commit}) { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
getDictionary({code: 'flow'}).then(res => { |
||||||
|
commit('SET_FLOW_ROUTES', res.data.data); |
||||||
|
resolve(); |
||||||
|
}).catch(error => { |
||||||
|
reject(error) |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
}, |
||||||
|
mutations: { |
||||||
|
SET_FLOW_ROUTES: (state, data) => { |
||||||
|
state.flowRoutes = data.map(item => { |
||||||
|
return { |
||||||
|
routeKey: `${item.code}_${item.dictKey}`, |
||||||
|
routeValue: item.remark, |
||||||
|
}; |
||||||
|
}); |
||||||
|
setStore({name: 'flowRoutes', content: state.flowRoutes, type: 'session'}) |
||||||
|
}, |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
export default dict; |
||||||
@ -0,0 +1,92 @@ |
|||||||
|
/** |
||||||
|
* 不为空 |
||||||
|
* @param val |
||||||
|
* @returns {boolean} |
||||||
|
*/ |
||||||
|
export function notEmpty(val) { |
||||||
|
return !this.isEmpty(val); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 为空 |
||||||
|
* @param val |
||||||
|
* @returns {boolean} |
||||||
|
*/ |
||||||
|
export function isEmpty(val) { |
||||||
|
if ( |
||||||
|
val === null || |
||||||
|
typeof val === 'undefined' || |
||||||
|
(typeof val === 'string' && val === '' && val !== 'undefined') |
||||||
|
) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 强转int型 |
||||||
|
* @param val |
||||||
|
* @param defaultValue |
||||||
|
* @returns {number} |
||||||
|
*/ |
||||||
|
export function toInt(val, defaultValue) { |
||||||
|
if (this.isEmpty(val)) { |
||||||
|
return defaultValue === undefined ? -1 : defaultValue; |
||||||
|
} |
||||||
|
const num = parseInt(val, 0); |
||||||
|
return Number.isNaN(num) ? (defaultValue === undefined ? -1 : defaultValue) : num; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Json强转为Form类型 |
||||||
|
* @param obj |
||||||
|
* @returns {FormData} |
||||||
|
*/ |
||||||
|
export function toFormData(obj) { |
||||||
|
const data = new FormData(); |
||||||
|
Object.keys(obj).forEach(key => { |
||||||
|
data.append(key, Array.isArray(obj[key]) ? obj[key].join(',') : obj[key]); |
||||||
|
}); |
||||||
|
return data; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* date类转为字符串格式 |
||||||
|
* @param date |
||||||
|
* @param format |
||||||
|
* @returns {null} |
||||||
|
*/ |
||||||
|
export function format(date, format = 'YYYY-MM-DD HH:mm:ss') { |
||||||
|
return date ? date.format(format) : null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据逗号联合 |
||||||
|
* @param arr |
||||||
|
* @returns {string} |
||||||
|
*/ |
||||||
|
export function join(arr) { |
||||||
|
return arr ? arr.join(',') : ''; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据逗号分隔 |
||||||
|
* @param str |
||||||
|
* @returns {string} |
||||||
|
*/ |
||||||
|
export function split(str) { |
||||||
|
return str ? String(str).split(',') : ''; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据key获取流程路由 |
||||||
|
* @param routes |
||||||
|
* @param key |
||||||
|
*/ |
||||||
|
export function getFlowRoute(routes, key) { |
||||||
|
const data = routes.filter(d => { |
||||||
|
return d.routeKey === key; |
||||||
|
}); |
||||||
|
return data.length === 0 ? [] : data[0].routeValue; |
||||||
|
} |
||||||
|
|
||||||
Loading…
Reference in new issue