import {
	Loading
} from 'element-ui'
let appLoading

export function openLoading(loadingName) {
	let loadingText
	switch (loadingName) {
		case 'submit':
			loadingText = '提交'
			break;
		case 'detail':
			loadingText = '获取详情'
			break;
		case 'down':
			loadingText = '下载'
			break;
		case 'upload':
			loadingText = '上传附件'
			break;
		case 'del':
			loadingText = '删除'
			break;
	}
	appLoading = Loading.service({
		text: "正在" + loadingText + "，请稍候",
		spinner: "el-icon-loading",
		background: "rgba(0, 0, 0, 0.7)",
		customClass: 'loadingclass',// **遮罩层新增类名，如果需要修改loading的样式**
	})
	setTimeout(() => {
		appLoading.close();
	}, 10000)
}
export function closeLoading() {
	if (appLoading) {
		appLoading.close();
	}
}