# 可注入全局方法

# lgTableColumns

/**
 *  表格的columns 列表
 * @param {String} columns 表头
  * @return 格式化后的列表
 */
	app.provide('lgTableColumns', (columns) => {
		return columns
	});

# lgImageUpload

/**
 *  图片上传的注入
 */
	app.provide('lgImageUpload',  {
		action:'',//上传地址
		headers:{},//请求头
		accept:['image/png',],//配置可上传格式
		data:{}//上传图片携带的参数
	});

# lgFileUpload

/**
 * 文件上传的注入
 */
	app.provide('lgFileUpload',  {
		action:'',//上传地址
		headers:{},//请求头
		accept:['image/png',],//配置可上传格式
		data:{}//上传图片携带的参数
	});

# lgTablePagination

/**
 * 表格分页格式全局修改注入
 * @param {Object} datas 请求获取的数据
 */
	app.provide('lgTablePagination',(datas) => {
	    return {
				   showQuickJumper: true,
				   total: parseInt(datas.total|| 10),
				   hideOnSinglePage: true,
				   pageSizeOptions: ["10", "20"],
				   current: parseInt(datas.current || 1),
				   pageSize: parseInt(datas.size|| 10),
				   showTotal: (total) => `${total}`,
				   showSizeChanger: true,
				 };
	});

# lgTablePageType

/**
 * 表格分页格式对象标签格式
 */
	app.provide('lgTablePagination',{
        page:'current', //当前页
			limit:'size', //页大小
			total:'total', //总数名
			list:'records' // 数据名
    });

# lgGetDictionary

/**
 * 字典注入到筛选组件
 */
import { getDictionary } from '/src/utils/dictionary.js';
	app.provide('lgGetDictionary',getDictionary);

# lgEditorUpload

/**
 * 富文本上传文件
 * file 数据值
 * insertFn 回调值
 */
	app.provide('lgEditorUpload', (file, insertFn) => {
		let type = ['image/png', 'image/gif', 'image/bmp', 'image/jpeg'];
		if (type.indexOf(file.type) == -1) {
			message.warning('图片格式错误!!!');
			return false;
		}
		let req = new FormData();
		req.append('file', file);
		uploadfile(req).then((res) => {
			let url = `${res.data}`;
			insertFn(url);
		});
	});