Commit f00acf68 authored by 田翔's avatar 田翔

fix: 打印配置自定义化

parent 79d7a6c5
Pipeline #89978 passed with stages
...@@ -134,7 +134,6 @@ const WorkflowHomePage = () => { ...@@ -134,7 +134,6 @@ const WorkflowHomePage = () => {
// setCurrentList(list); // setCurrentList(list);
// } // }
setCurrentList(list); setCurrentList(list);
console.log(flowNameList, 'flowNameList');
setFlowNames(flowNameList); setFlowNames(flowNameList);
} else { } else {
message.error(res.msg); message.error(res.msg);
...@@ -294,7 +293,7 @@ const WorkflowHomePage = () => { ...@@ -294,7 +293,7 @@ const WorkflowHomePage = () => {
} }
}); });
}, },
onCancel() {}, onCancel() { },
}); });
} else { } else {
confirm({ confirm({
...@@ -323,7 +322,7 @@ const WorkflowHomePage = () => { ...@@ -323,7 +322,7 @@ const WorkflowHomePage = () => {
message.error('网络异常请稍后再试'); message.error('网络异常请稍后再试');
}); });
}, },
onCancel() {}, onCancel() { },
}); });
} }
} else { } else {
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { CreateFlow } from '@/services/workflow/workflow'; import { CreateFlow } from '@/services/workflow/workflow';
import { Form, Modal, Input, notification, Select, Radio, Switch, Tooltip, Row, Col } from 'antd'; import { Form, Modal, Input, notification, Select, Radio, Switch, Tooltip, Row, Col, Checkbox } from 'antd';
import { InfoCircleOutlined } from '@ant-design/icons'; import { InfoCircleOutlined } from '@ant-design/icons';
const { Option } = Select; const { Option } = Select;
const { TextArea } = Input; const { TextArea } = Input;
const FlowModal = props => { const FlowModal = props => {
const { onSubumit, handleCancel, visible, msg, modalType, treeData, keep } = props; const { onSubumit, handleCancel, visible, msg, modalType, treeData, keep } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [flag, setFlag] = useState(0); const [flag, setFlag] = useState(0);
const [isPrint, setIsPrint] = useState(Boolean(msg.isPrint))
const [oMultiDiff, setOMultiDiff] = useState({ const [oMultiDiff, setOMultiDiff] = useState({
'19969': 'DZ', '19969': 'DZ',
'19975': 'WM', '19975': 'WM',
...@@ -391,11 +393,10 @@ const FlowModal = props => { ...@@ -391,11 +393,10 @@ const FlowModal = props => {
useEffect(() => { useEffect(() => {
form.resetFields(); form.resetFields();
if (visible) { if (visible) {
console.log(keep);
console.log(msg);
if (modalType === 'edit') { if (modalType === 'edit') {
getFormData(); getFormData();
} else { } else {
setIsPrint(Boolean(msg.isPrint))
form.setFieldsValue({ Type: msg.name, Prefix: '', DoneView: 0 }); form.setFieldsValue({ Type: msg.name, Prefix: '', DoneView: 0 });
setFlag(flag + 1); setFlag(flag + 1);
} }
...@@ -403,9 +404,14 @@ const FlowModal = props => { ...@@ -403,9 +404,14 @@ const FlowModal = props => {
}, [visible]); }, [visible]);
// 获取表单回显 // 获取表单回显
const getFormData = () => { const getFormData = () => {
form.setFieldsValue({ ...msg, isPrint: Boolean(msg.isPrint), IsPrintAux: Boolean(msg.IsPrintAux) }); setIsPrint(Boolean(msg.isPrint))
form.setFieldsValue({
...msg,
isPrint: Boolean(msg?.isPrint),
IsPrintFlow: Boolean(msg?.IsPrintAux),
IsPrintRelationForm: Boolean(msg?.PrintConfig?.IsPrintRelationForm),
});
setFlag(flag + 1); setFlag(flag + 1);
console.log(form.getFieldValue('Prefix'),form.getFieldValue('IsPrintAux'), 'fffff');
}; };
// 提交表单 // 提交表单
const onFinish = () => { const onFinish = () => {
...@@ -420,6 +426,11 @@ const FlowModal = props => { ...@@ -420,6 +426,11 @@ const FlowModal = props => {
datas[key] = 1; datas[key] = 1;
} }
} }
if (key === 'IsPrintRelationForm') {
datas.PrintConfig = {
IsPrintRelationForm: datas['IsPrintRelationForm'] ? 1 : 0
}
}
} }
let obj = {}; let obj = {};
if (modalType === 'add') { if (modalType === 'add') {
...@@ -459,6 +470,16 @@ const FlowModal = props => { ...@@ -459,6 +470,16 @@ const FlowModal = props => {
setFlag(flag + 1); setFlag(flag + 1);
} }
}; };
const onValuesChange = (values) => {
if ('isPrint' in values) {
setIsPrint(values.isPrint)
if (values.isPrint) {
form.setFieldsValue({ IsPrintRelationForm: true })
}
}
}
const prefix = value => { const prefix = value => {
let str = value; let str = value;
if (typeof str !== 'string') { if (typeof str !== 'string') {
...@@ -517,7 +538,6 @@ const FlowModal = props => { ...@@ -517,7 +538,6 @@ const FlowModal = props => {
} }
} }
let data = arrRslt.toString().slice(0, 6); let data = arrRslt.toString().slice(0, 6);
console.log(arrRslt.toString().slice(0, 6));
return data; return data;
}; };
return ( return (
...@@ -527,6 +547,7 @@ const FlowModal = props => { ...@@ -527,6 +547,7 @@ const FlowModal = props => {
onOk={onFinish} onOk={onFinish}
onCancel={handleCancel} onCancel={handleCancel}
maskClosable={false} maskClosable={false}
width={580}
destroyOnClose destroyOnClose
> >
<Form <Form
...@@ -534,6 +555,7 @@ const FlowModal = props => { ...@@ -534,6 +555,7 @@ const FlowModal = props => {
labelCol={{ span: 5 }} labelCol={{ span: 5 }}
wrapperCol={{ span: 18 }} wrapperCol={{ span: 18 }}
onFieldsChange={changeValue} onFieldsChange={changeValue}
onValuesChange={onValuesChange}
> >
<Form.Item <Form.Item
label="流程名称" label="流程名称"
...@@ -732,12 +754,23 @@ const FlowModal = props => { ...@@ -732,12 +754,23 @@ const FlowModal = props => {
</Radio> </Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
<Form.Item label="是否打印" name="isPrint" valuePropName="checked"> <Row>
<Col span={8}>
<Form.Item labelCol={{ span: 15 }} label="是否打印" name="isPrint" valuePropName="checked">
<Switch checkedChildren="是" unCheckedChildren="否" /> <Switch checkedChildren="是" unCheckedChildren="否" />
</Form.Item> </Form.Item>
<Form.Item label="打印附加" name="IsPrintAux" valuePropName="checked"> </Col>
<Switch checkedChildren="是" unCheckedChildren="否" /> <Col span={8} style={{ display: isPrint ? 'block' : 'none' }}>
<Form.Item label="" name="IsPrintRelationForm" valuePropName="checked">
<Checkbox>附表:关联表单</Checkbox>
</Form.Item> </Form.Item>
</Col>
<Col span={8} style={{ display: isPrint ? 'block' : 'none' }}>
<Form.Item label="" name="IsPrintAux" valuePropName="checked">
<Checkbox>附表:流程信息</Checkbox>
</Form.Item>
</Col>
</Row>
<Form.Item label="打印模板" name="printTemp"> <Form.Item label="打印模板" name="printTemp">
<Input placeholder="本项为空,使用默认模板,支持定制" /> <Input placeholder="本项为空,使用默认模板,支持定制" />
</Form.Item> </Form.Item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment