提交 0afe022c authored 作者: 钟是志's avatar 钟是志

增加中医大的 lodop 打印 派遣报到证

上级 67d756f9
...@@ -128,7 +128,7 @@ export const templateCode = [ ...@@ -128,7 +128,7 @@ export const templateCode = [
}, },
{ {
path: '/jy/paiqian/signing/stuSignPrint', path: '/jy/paiqian/signing/stuSignPrint',
code: 'xxx',// 宝鸡派遣报到证 打印 TODO code: 'studentDispatch',// 宝鸡派遣报到证 打印
name: '就业报到证', name: '就业报到证',
}, },
]; ];
...@@ -42,7 +42,7 @@ export default class ViewPrint extends Component { ...@@ -42,7 +42,7 @@ export default class ViewPrint extends Component {
if (!viewData || !viewData.length) { if (!viewData || !viewData.length) {
message.warning('未查询到可打印的奖状数据'); message.warning('未查询到可打印的数据');
console.error(`${x.queryUrl}接口报错或者没有返回数据`); console.error(`${x.queryUrl}接口报错或者没有返回数据`);
return false; return false;
} }
...@@ -343,7 +343,7 @@ export default class ViewPrint extends Component { ...@@ -343,7 +343,7 @@ export default class ViewPrint extends Component {
name={'字段位置设置(实施)'} name={'字段位置设置(实施)'}
handleClick={() => { handleClick={() => {
router.push({ router.push({
pathname: '/xg/xg_hard/AwardSet/printSetting', pathname: '/jc/setting/printSetting',
state: { code: templateInfo.code }, state: { code: templateInfo.code },
}); });
}} }}
......
import React from 'react';
import { message } from 'antd';
import { redText } from '@/pages/zydxg/CheckManage/PiciSetting/publicFunc';
import { isJSON } from '@/webPublic/one_stop_public/copy';
import ConfirmModal from '@/pages/zydzs/AdmissionActivityManage/ActivityPublish/CheckInSituation_parent/ConfirmModal';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import { A4Height, A4Width, defaultConfigInfo } from '@/webPublic/zyd_private/DragAndPrint/ViewPrint/config';
/**
*
backgroundUrl: "http://scjoyedu.eicp.net:51337/dsf/test108/u/upload/202005/27135813bxl6.jpg"
callUrl: "/PublicPrintApi/studentCard/printed"
code: "studentCard"
config: [{content: "${name}", errCode: "", errLog: "", errMsg: "", fieldCode: "name", fieldFont: "黑体",…},…]
errCode: ""
errLog: ""
errMsg: ""
hasPrintBackground: true
high: null
queryUrl: "/PublicPrintApi/studentCard/query"
respcode: "00"
respdesc: ""
wide: null
* */
export default ({ configAll, location }) => {
const outSideData = {
...configAll,
};
delete outSideData.config;
const { config } = configAll;
return [
{
type: 'basicConfig',
component: 'ModalForm',
nameSpan: { big: 8, small: 10 },
values: {
...outSideData,
info: !outSideData.info ? JSON.stringify(defaultConfigInfo) : outSideData.info,
},
url: '/PublicPrintApi/update',
name: '基础项配置',
beforeSubmit: (props, formValues) => {
if (formValues && formValues.backgroundUrl && isJSON(formValues)) {
formValues.backgroundUrl = JSON.parse(formValues.backgroundUrl).url;
}
if (formValues && formValues.backgroundUrl && typeof formValues.backgroundUrl === 'object') {
formValues.backgroundUrl = formValues.backgroundUrl.url;
}
const data = {
...outSideData,
...formValues,
};
delete data.config;
return data;
},
fields: [
{
key: 'code',
name: '编码',
type: 'input',
disabled: true,
},
{
key: 'backgroundUrl',
name: '背景模版图片',
required: true,
type: 'buttonUpload',
accept: 'image/*',
},
{
key: 'hasPrintBackground',
name: '是否打印背景模版',
type: 'select',
options: [
{
key: 'true',
name: '打印',
},
{
key: 'false',
name: '隐藏',
},
],
},
{
key: 'printMeth',
name: '打印方向',
type: 'select',
options: [
{
key: '1',
name: '横向',
},
{
key: '2',
name: '竖向',
},
],
},
{
key: 'high',
name: '渲染HTML高度(单位厘米)',
type: 'inputNumber',
precision: 1,
min: 5,
max: 200,
},
{
key: 'wide',
name: '渲染HTML宽度(单位厘米)',
type: 'inputNumber',
precision: 1,
min: 5,
max: 200,
},
{
key: 'info',
name: '其他配置信息JSON',
type: 'textarea',
},
{
type: 'component',
render: () => {
return <p style={{color: 'red'}}>
提示:{'{"paperHeight":"29.7cm","paperWidth":"21cm"} A4渲染高度28.5 A4渲染宽度19.7'}
</p>;
},
},
],
},
{
type: 'return',
name: '返回',
component: 'RenderComponent',
render: () => {
if (location && location.state) {
return <ButtonDiy name='返回'
className='defaultRed'
key={'return'}
handleClick={() => {
window.history.back(-1);
}}/>;
} else {
return null;
}
},
},
{
type: 'remark',
name: '备注',
component: 'RenderComponent',
render: () => {
return <span key={'remark'}>
{redText('谨慎修改,如不清楚配置项意义,请联系开发人员.')}
</span>;
},
},
];
};
import React, { Fragment } from 'react';
import { InputNumber, message } from 'antd';
import {
defaultConfigInfo,
defaultItemConfigInfo,
fieldTypeList,
fontFamilyList,
templateCode,
} from '@/webPublic/zyd_private/DragAndPrint/ViewPrint/config';
import { getInfo } from '@/highOrderComponent/Service';
const saveItemConfig = (data, getPage) => {
if (typeof data.newY !== 'undefined' || typeof data.newX !== 'undefined') {
let info = { ...data };
info.x = (typeof data.newX !== 'undefined' && data.newX) || info.x;
info.y = (typeof data.newY !== 'undefined' && data.newY) || info.y;
getInfo({
contentStr: JSON.stringify([info]),
}, '/PublicPrintApi/update').then((x) => {
if(x){
getPage();
message.success('保存成功');
}
});
}
};
const handleColumns = (props) => {
return [
{
dataIndex: 'title',
title: '字段',
type: 'input',
},
{
dataIndex: 'content',
title: '显示内容',
type: 'input',
},
{
dataIndex: 'mark',
title: '换行分隔符',
type: 'input',
},
{
dataIndex: 'fieldType',
title: '显示类型',
type: 'select',
options: fieldTypeList,
render: (text) => {
for (let item of fieldTypeList) {
if (item.key === text) {
return item.name;
}
}
return text;
},
},
{
dataIndex: 'high',
title: '显示高度',
type: 'inputNumber',
},
{
dataIndex: 'wide',
title: '显示宽度',
type: 'inputNumber',
},
{
dataIndex: 'hasHidden',
title: '是否隐藏',
type: 'select',
options: [{ key: 'true', name: '是' }, { key: 'false', name: '否' }],
render: (text) => {
return text ? '是' : '否';
},
},
{
dataIndex: 'fieldFont',
title: '字体',
type: 'select',
options: fontFamilyList,
},
{
dataIndex: 'fieldFontSize',
title: '文字大小',
type: 'inputNumber',
min: 12,
max: 100,
precision: 0,
},
{
dataIndex: 'x',
title: 'x轴偏移量',
type: 'inputNumber',
renderConfig: {
type: 'component',
render: function({ text, record, getPage }) {
return (
<Fragment>
{text}
<InputNumber
precision={0}
onChange={(value) => {
record.newX = value;
}}
defaultValue={text}
/>
</Fragment>
);
},
},
precision: 0,
},
{
dataIndex: 'y',
title: 'y轴偏移量',
type: 'inputNumber',
precision: 0,
renderConfig: {
type: 'component',
render: function({ text, record, getPage }) {
return (
<Fragment>
{text}
<InputNumber
precision={0}
onChange={(value) => {
record.newY = value;
}}
defaultValue={text}
/>
</Fragment>
);
},
},
},
{
dataIndex: 'save',
title: '保存',
renderConfig: {
type: 'component',
render: function({ text, record, getPage }) {
return (
<a
onClick={() => {
saveItemConfig(record, getPage);
}}>
保存
</a>
);
},
},
},
{
dataIndex: 'fieldPattern',
title: '显示格式',
type: 'input',
},
{
dataIndex: 'transform',
title: '旋转角度',
type: 'inputNumber',
min: 0,
max: 360,
precision: 0,
},
];
};
const pageSearch = ({ changeConfigAll, configAll, location }) => {
const columns = handleColumns();
const fields = columns
.filter((y) => {
return y.type;
})
.map((x) => {
if (x.type) {
return {
...x,
name: x.title,
key: x.dataIndex,
};
} else {
return null;
}
});
fields.push({
key: 'info',
name: '其他配置项JSON',
type: 'textarea',
});
columns.push({
dataIndex: 'operation',
title: '操作',
renderConfig: {
type: 'ModalEdit',
name: '编辑',
width: 900,
fileSpan: { big: 2, small: 2 },
nameSpan: { big: 7, small: 7 },
url: '/PublicPrintApi/update',
fields,
beforeUpdate: (record, formValues) => {
formValues.info =
formValues.info || JSON.stringify(defaultItemConfigInfo); // 其他配置项JSON
return {
contentStr: JSON.stringify([
{
...record,
...formValues,
},
]),
};
},
responseCallBack: (response) => {
if (!response) {
return false;
} else {
return response;
}
},
},
});
return {
search: {
url: '/PublicPrintApi/query',
field: {
code: {
defaultValue:
(location && location.state && location.state.code) ||
'studentCard',
required: true,
},
},
scroll: { x: 'max-content' },
giveFieldsToFormValues: true,
responseCallBack: (response) => {
changeConfigAll(response);
return response.config;
},
afterFormValuesChange: (key, oldValue, getPage) => {
if (key === 'code') {
getPage();
}
},
condition: [
{
key: 'code',
name: '业务功能',
type: 'select',
options: templateCode.map((x) => {
return {
key: x.code,
name: x.name,
};
}),
},
],
nameSpan: { big: 8, small: 9 },
fileSpan: { big: 4, small: 4 },
},
tableRowKey: 'id',
columns,
};
};
/****
* content: "${name}"
errCode: ""
errLog: ""
errMsg: ""
fieldCode: "name"
fieldFont: "黑体"
fieldFontSize: null
fieldPattern: ""
fieldType: "0"
hasHidden: false
id: 6
respcode: "00"
respdesc: ""
title: "姓名"
transform: 0
x: 648
y: 798
*
* */
export default pageSearch;
const pageSetting = {
type: 'list', // 页面类型 list列表 可能包含有其他类型的 比如 detail 详情 add 新增 update 更新 等等 ....
listConfig: {
selectRows: true, // 是否可以行选择,
paging: false, // 是否可以分页,
searchArea: true, // 是否拥有 搜索区dom,
buttonArea: true, // 是否拥有 按钮区,
},
};
export default pageSetting;
/**
* 打印配置
* 2020年5月29日 09:52:44
* 钟是志
* */
import React, { Component } from 'react';
import pageSetting from './PageSetting';
import pageButton from './PageButton';
import pageSearch from './PageSearch';
import PageTypeMatching from '@/highOrderComponent/PageTypeMatching';
import { getInfo } from '@/highOrderComponent/Service';
class Index extends Component {
constructor(props) {
super(props);
this.state = {
configAll: {
config: [],
},
};
}
changeConfigAll = (configAll) => {
this.setState({
configAll,
});
};
componentDidMount() {
}
render() {
const { configAll } = this.state;
const { location } = this.props;
return (
<PageTypeMatching
pageSetting={pageSetting}
pageButton={pageButton({
configAll,
location,
})}
pageSearch={pageSearch({
changeConfigAll: this.changeConfigAll,
configAll,
location,
})}
/>
);
}
}
export default Index;
/**
* 钟是志
* 2020年5月25日 18:03:24
* 拖拽配置 打印数据页面
* 用于中医大评奖评优 奖状打印
* 后续可以会应用于其他学校的其他 打印.
* */
import React, { Component } from 'react';
import DragSetting from '@/webPublic/zyd_private/DragAndPrint/index';
export default class Index extends Component {
render() {
const { location } = this.props;
let code = 'award';
if(location && location.state && location.state.code){
code = location.state.code;
}
return (
<DragSetting code={code}/>
);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论