config.js 2.6 KB
Newer Older
1 2
import { message } from 'antd';
import { ModalConfirm, ModalInfo } from '@/baseComponent/Modal';
钟是志's avatar
钟是志 committed
3
import * as lo from './LodopFuncs';
4

钟是志's avatar
钟是志 committed
5 6
export const A4Height = '29.7cm';
export const A4Width = '21cm';
7
export const imageStyleAll = {
8 9
	width: '100%',
	// height: '100%',
10
};
11

钟是志's avatar
钟是志 committed
12
export const defaultConfigInfo = {
13 14
	paperHeight: A4Height,
	paperWidth: A4Width,
钟是志's avatar
钟是志 committed
15 16
};

17
export const defaultItemConfigInfo = {
18
	textStyle: {},
19 20
};

21
export function getCLodopFuncJS() {
22 23 24
	return new Promise((resolve, reject) => {
		resolve(true);
	});
25

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
	return new Promise((resolve, reject) => {
		if (window.LODOP) {
			console.log('打印插件加载成功');
			resolve(true);
			return true;
		}
		let sc = document.createElement('script');
		if (window.location.protocol === 'http:') {
			sc.src = `http://localhost:18000/CLodopFuncs.js`;
		} else {
			sc.src = `https://localhost:8443/CLodopFuncs.js`;
		}
		document.querySelector('body').appendChild(sc);
		sc.onload = function() {
			resolve(true);
			console.log('打印插件加载成功');
		};
		sc.onerror = function() {
			resolve(false);
			ModalConfirm('请下载并运行打印控件后刷新本页面继续打印!' + '点击确定进行控件下载', {
				title: '未获取到打印控件',
				onOk: () => {
					window.open(window.location.origin + '/zyd/CLodop_32_Print.zip');
				},
			});
		};
	});
53
}
54 55

export const fieldTypeList = [
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
	{
		key: '-2',
		name: '条形码',
	},
	{
		key: '-1',
		name: '常量',
	},
	{
		key: '0',
		name: '文字',
	},
	{
		key: '1',
		name: '时间',
	},
	{
		key: '2',
		name: '照片',
	},
76 77 78
];

export const fontFamilyList = [
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
	{
		key: '宋体',
		name: '宋体',
	},
	{
		key: '楷体',
		name: '楷体',
	},
	{
		key: '黑体',
		name: '黑体',
	},
	{
		key: '隶书',
		name: '隶书',
	},
	{
		key: '微软雅黑',
		name: '微软雅黑',
	},
99 100 101
];

export const styleCount = (config) => {
102 103 104 105 106 107
	const style = {
		fontSize: `${config.fieldFontSize || 16}px`, // 默认 16px
		fontFamily: `${config.fieldFont || '黑体'}`, // 默认黑体 包括 ('宋体','楷体','黑体','隶书','微软雅黑等字体'}
		lineHeight: `${config.fieldFontSize || 16}px`,
	};
	return style;
108
};
109 110

export const templateCode = [
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
	{
		path: '/xg/xg_hard/SearchAndPrint/printReview',
		code: 'award',
		name: '评奖评优奖状',
	},
	{
		path: '/xg/student_affairs/replace/printStudentCard',
		code: 'reissueStudentCard',
		name: '学生证补办打印',
	},
	{
		path: '/xg/stundents_record/printStudentCard',
		code: 'studentCard',
		name: '学生信息-学生证打印',
	},
	{
		path: '/jy/paiqian/biye/printSome',
		code: 'studentDispatch', // 宝鸡派遣报到证 打印
		name: '就业报到证',
	},
131
];