Commit f00acf68 authored by 田翔's avatar 田翔

fix: 打印配置自定义化

parent 79d7a6c5
Pipeline #89978 passed with stages
......@@ -134,7 +134,6 @@ const WorkflowHomePage = () => {
// setCurrentList(list);
// }
setCurrentList(list);
console.log(flowNameList, 'flowNameList');
setFlowNames(flowNameList);
} else {
message.error(res.msg);
......@@ -294,7 +293,7 @@ const WorkflowHomePage = () => {
}
});
},
onCancel() {},
onCancel() { },
});
} else {
confirm({
......@@ -323,7 +322,7 @@ const WorkflowHomePage = () => {
message.error('网络异常请稍后再试');
});
},
onCancel() {},
onCancel() { },
});
}
} else {
......@@ -397,7 +396,7 @@ const WorkflowHomePage = () => {
<div className={styles.left}>
<div
className={classnames(styles.allFlows, { [styles.allFlowsChoose]: true })}
// onClick={chageAll}
// onClick={chageAll}
/>
<div className={styles.flows}>
{/* <Anchor affix={false} onClick={toFlowGroup}>
......@@ -491,9 +490,9 @@ const WorkflowHomePage = () => {
onInput={e => {
e.currentTarget.style.width = e.currentTarget.value.length * 14 + 'px';
}}
// onPressEnter={e => {
// console.log(e, '触发咯');
// }}
// onPressEnter={e => {
// console.log(e, '触发咯');
// }}
/>
</div>
<EditOutlined
......
import React, { useState, useEffect } from 'react';
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';
const { Option } = Select;
const { TextArea } = Input;
const FlowModal = props => {
const { onSubumit, handleCancel, visible, msg, modalType, treeData, keep } = props;
const [form] = Form.useForm();
const [flag, setFlag] = useState(0);
const [isPrint, setIsPrint] = useState(Boolean(msg.isPrint))
const [oMultiDiff, setOMultiDiff] = useState({
'19969': 'DZ',
'19975': 'WM',
......@@ -391,11 +393,10 @@ const FlowModal = props => {
useEffect(() => {
form.resetFields();
if (visible) {
console.log(keep);
console.log(msg);
if (modalType === 'edit') {
getFormData();
} else {
setIsPrint(Boolean(msg.isPrint))
form.setFieldsValue({ Type: msg.name, Prefix: '', DoneView: 0 });
setFlag(flag + 1);
}
......@@ -403,9 +404,14 @@ const FlowModal = props => {
}, [visible]);
// 获取表单回显
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);
console.log(form.getFieldValue('Prefix'),form.getFieldValue('IsPrintAux'), 'fffff');
};
// 提交表单
const onFinish = () => {
......@@ -420,6 +426,11 @@ const FlowModal = props => {
datas[key] = 1;
}
}
if (key === 'IsPrintRelationForm') {
datas.PrintConfig = {
IsPrintRelationForm: datas['IsPrintRelationForm'] ? 1 : 0
}
}
}
let obj = {};
if (modalType === 'add') {
......@@ -459,6 +470,16 @@ const FlowModal = props => {
setFlag(flag + 1);
}
};
const onValuesChange = (values) => {
if ('isPrint' in values) {
setIsPrint(values.isPrint)
if (values.isPrint) {
form.setFieldsValue({ IsPrintRelationForm: true })
}
}
}
const prefix = value => {
let str = value;
if (typeof str !== 'string') {
......@@ -517,7 +538,6 @@ const FlowModal = props => {
}
}
let data = arrRslt.toString().slice(0, 6);
console.log(arrRslt.toString().slice(0, 6));
return data;
};
return (
......@@ -527,6 +547,7 @@ const FlowModal = props => {
onOk={onFinish}
onCancel={handleCancel}
maskClosable={false}
width={580}
destroyOnClose
>
<Form
......@@ -534,6 +555,7 @@ const FlowModal = props => {
labelCol={{ span: 5 }}
wrapperCol={{ span: 18 }}
onFieldsChange={changeValue}
onValuesChange={onValuesChange}
>
<Form.Item
label="流程名称"
......@@ -732,12 +754,23 @@ const FlowModal = props => {
</Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="是否打印" name="isPrint" valuePropName="checked">
<Switch checkedChildren="是" unCheckedChildren="否" />
</Form.Item>
<Form.Item label="打印附加" name="IsPrintAux" valuePropName="checked">
<Switch checkedChildren="是" unCheckedChildren="否" />
</Form.Item>
<Row>
<Col span={8}>
<Form.Item labelCol={{ span: 15 }} label="是否打印" name="isPrint" valuePropName="checked">
<Switch checkedChildren="是" unCheckedChildren="否" />
</Form.Item>
</Col>
<Col span={8} style={{ display: isPrint ? 'block' : 'none' }}>
<Form.Item label="" name="IsPrintRelationForm" valuePropName="checked">
<Checkbox>附表:关联表单</Checkbox>
</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">
<Input placeholder="本项为空,使用默认模板,支持定制" />
</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